You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/event-grid/mqtt-how-to-http-publish.md
+45-92Lines changed: 45 additions & 92 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,7 @@ ms.custom:
16
16
---
17
17
18
18
# How to Publish MQTT Messages via HTTP with Azure Event Grid
19
-
Azure Event Grid now supports publishing MQTT messages via HTTP, enabling backend systems to send messages to devices without maintaining persistent MQTT connections. This approach simplifies integration for applications that prefer stateless communication, leverages secure authentication with Entra ID, and provides scalable, reliable delivery to MQTT clients. In this article, you'll learn how to use the HTTP Publish API, obtain the necessary credentials, and verify message delivery using popular tools like Postman, Bruno, and MQTTX.
19
+
Azure Event Grid now supports publishing MQTT messages via HTTP, enabling backend systems to send messages to devices without maintaining persistent MQTT connections. This approach simplifies integration for applications that prefer stateless communication, uses secure authentication with Entra ID, and provides scalable, reliable delivery to MQTT clients. In this article, you learn how to use the HTTP Publish API, obtain the necessary credentials, and verify message delivery using popular tools like Bruno, and MQTTX.
20
20
21
21
This article explains how to publish MQTT messages via HTTP with Azure Event Grid.
22
22
@@ -30,114 +30,67 @@ This article explains how to publish MQTT messages via HTTP with Azure Event Gri
30
30
Run the following Azure CLI command to get a bearer token.
31
31
32
32
```bash
33
-
az account get-access-token --resource=https://<namespace> --query accessToken -o tsv
33
+
az account get-access-token --resource=https://<namespaceFQDN> --query accessToken -o tsv
34
34
```
35
35
36
-
## Import to Bruno
37
-
Use a tool such as Bruno to
36
+
Save this token to use in the `Authorization: Bearer <TOKEN>` header.
38
37
39
-
1. Open Bruno.
40
-
1. Select **Import Collection**, and then select `EventGrid_HTTP_Publish_Postman_Collection.json`.
41
-
1. Go to **Variables** tab:
42
-
- Replace `{{namespace}}` with your namespace FQDN.
43
-
- Replace `{{topic}}` with your MQTT topic.
44
-
- Replace `{{entra_token}}` with your token from Step 2.
45
-
1. Select **Send** — you should get 202 or 204.
46
-
47
-
## Step 4: Verify in MQTTX
38
+
# [cURL](#tab/curl)
48
39
49
-
- Open MQTTX and connect using your broker’s endpoint, TLS, and your normal MQTT auth.
50
-
- Subscribe to the topic you used in the HTTP POST.
51
-
- You should see your payload appear.
52
-
53
-
## Troubleshoot
40
+
Here’s an example cURL command to simulate the HTTP Publish.
54
41
55
-
-**401 Unauthorized?** — Refresh your token.
56
-
-**403 Forbidden?** — Check your topic or permissions.
57
-
-**Message doesn’t appear?** — Ensure topic is percent-encoded in the URL, check broker routing config, and verify you’re using the same namespace.
0 commit comments