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
+6-3Lines changed: 6 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,9 +15,12 @@ ms.custom:
15
15
- ai-gen-description
16
16
---
17
17
18
-
# How to Publish MQTT Messages via HTTP with Azure Event Grid
18
+
# How to Publish MQTT Messages via HTTP with Azure Event Grid (preview)
19
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
+
> [!NOTE]
22
+
> This feature is currently in preview.
23
+
21
24
This article explains how to publish MQTT messages via HTTP with Azure Event Grid.
22
25
23
26
## Get Your Connection Details
@@ -35,7 +38,7 @@ az account get-access-token --resource=https://<namespaceFQDN> --query accessTok
35
38
36
39
Save this token to use in the `Authorization: Bearer <TOKEN>` header.
37
40
38
-
# [cURL](#tab/curl)
41
+
###[cURL](#tab/curl)
39
42
40
43
Here’s an example cURL command to simulate the HTTP Publish.
41
44
@@ -57,7 +60,7 @@ In this sample command:
57
60
- Add optional headers for QoS, retain flag, response topic, user properties.
title: Publish MQTT Messages via HTTP with Azure Event Grid
2
+
title: HTTP Publish of MQTT messages with Azure Event Grid
3
3
description: Publish MQTT messages via HTTP with Azure Event Grid for scalable server-to-device communication. Learn how to use the HTTP Publish API effectively.
4
4
#customer intent: As a backend developer, I want to publish MQTT messages via HTTP so that I can integrate with Azure Event Grid without maintaining persistent MQTT sessions.
5
5
author: spelluru
@@ -15,31 +15,34 @@ ms.custom:
15
15
- ai-gen-description
16
16
---
17
17
18
-
# Overview
18
+
# HTTP Publish of MQTT messages with Azure Event Grid (preview)
19
19
20
20
The Azure Event Grid MQTT Broker HTTP Publish API empowers customers to publish MQTT messages using standard HTTP requests. This complements direct MQTT client connections, providing a simple and scalable option for server-side systems that prefer HTTP for server-to-device command-and-control, updates, or retained message management.
21
21
22
+
> [!NOTE]
23
+
> This feature is currently in preview.
24
+
22
25
Key benefits:
23
26
24
27
- Allows backend services to send MQTT messages without keeping persistent MQTT sessions open.
25
28
- Helps protect broker stability by limiting per-client MQTT sessions.
26
29
- Ensures consistent message processing for both MQTT and HTTP-originated messages.
27
30
28
-
# When to Use HTTP Publish
31
+
##When to Use HTTP Publish
29
32
30
33
Consider HTTP Publish when:
31
34
32
35
- Your backend services are HTTP-native and need to send device commands or updates over MQTT.
33
36
- You want to manage retained messages without opening an MQTT connection.
34
37
- You need to scale up publish capacity without exhausting session limits.
35
38
36
-
# How It Works
39
+
##How It Works
37
40
38
41
1. HTTP clients issue an HTTP POST request with MQTT publish details.
39
42
1. Event Grid maps HTTP request parts to standard MQTT PUBLISH packet properties.
40
43
1. Messages flow through the Event Grid routing and enrichment pipeline, ensuring delivery guarantees and applying any enrichment or transformation.
41
44
42
-
# Example: MQTT PUBLISH Equivalent
45
+
##Example: MQTT PUBLISH Equivalent
43
46
44
47
```http
45
48
PUBLISH Topic Name: devices/CXa-23112/prompt
@@ -52,7 +55,7 @@ User Property: RequestId = 55f4a7ee-b0b4-4d7f-8eb5-2edba2ced5d7
52
55
Payload: Please accept terms of licensing and agreement
53
56
```
54
57
55
-
# Example: HTTP Publish Request
58
+
##Example: HTTP Publish Request
56
59
57
60
```http
58
61
POST /mqtt/messages?topic=devices%2FCXa-23112%2Fprompt&api-version=2025-02-15-preview HTTP/1.1
@@ -72,7 +75,7 @@ Please accept terms of licensing and agreement
72
75
73
76
74
77
75
-
# Request Parameters
78
+
##Request Parameters
76
79
77
80
This table describes how HTTP request parts map to MQTT PUBLISH packet properties. Refer to the original documentation for full details.
78
81
@@ -95,7 +98,7 @@ This table describes how HTTP request parts map to MQTT PUBLISH packet propertie
95
98
- Percent-encoding is required for topic and response topic.
96
99
- Correlation Data must be base64-encoded.
97
100
98
-
# High-level steps for using HTTP Publish
101
+
##High-level steps for using HTTP Publish
99
102
100
103
- Step 1: Prepare your Entra ID bearer token for authentication.
101
104
- Step 2: Construct your HTTP POST request to your Event Grid MQTT broker endpoint.
@@ -105,14 +108,14 @@ This table describes how HTTP request parts map to MQTT PUBLISH packet propertie
105
108
- Step 6: Send the request.
106
109
- Step 7: Confirm delivery via logs and metrics in the Event Grid portal.
107
110
108
-
# Authentication & Authorization
111
+
##Authentication & Authorization
109
112
110
-
- HTTP Publish uses Azure Entra ID for authentication.
113
+
- HTTP Publish uses Microsoft Entra ID for authentication.
111
114
- Add a Bearer token to the Authorization header.
112
-
- The Entra Object ID becomes the MQTT clientId.
115
+
- The Microsoft Entra Object ID becomes the MQTT clientId.
113
116
- The AuthN/AuthZ model aligns with standard MQTT connections.
114
117
115
-
# Routing, Enrichment & Observability
118
+
##Routing, Enrichment & Observability
116
119
117
120
- HTTP messages pass through the Event Grid routing pipeline, ensuring consistent routing, enrichment, and delivery guarantees.
118
121
@@ -123,148 +126,15 @@ This table describes how HTTP request parts map to MQTT PUBLISH packet propertie
123
126
- Source IP
124
127
- Auth principal
125
128
126
-
# Best Practices
129
+
##Best Practices
127
130
128
131
- Use lowercase header keys where possible. HTTP/2 header keys are case-insensitive.
129
132
- Monitor throughput — HTTP messages tend to be larger than direct MQTT messages.
130
133
- HTTP Publish shares throughput limits with direct MQTT publishes.
131
134
132
-
# Throttling
135
+
##Throttling
133
136
134
137
Be aware that HTTP Publish counts towards your overall MQTT throughput quota. Monitor your usage to avoid exceeding limits.
135
138
136
-
137
-
## How to use the HTTP Publish feature
138
-
139
-
### Step 1: Get Your Connection Details
140
-
141
-
- Namespace fully qualified doamin name (FQDN). Example: `contoso.westus3-1.ts.eventgrid.azure.net`.
142
-
- Topic. Example: `devices/CXa-23112/prompt`.
143
-
- Entra ID client credentials.
144
-
145
-
### Step 2: Get a bearer token
146
-
Run the following Azure CLI command to get a bearer token.
147
-
148
-
```bash
149
-
az account get-access-token --resource=https://<namespace> --query accessToken -o tsv
150
-
```
151
-
152
-
### Step 3: Import to Postman or Bruno
153
-
Use steps from the Postman (or) Bruno section, depending on the tool you are comfortable with.
Copy file name to clipboardExpand all lines: articles/event-grid/mqtt-overview.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -123,7 +123,7 @@ An MQTT retain message is used to store the last known good value of a topic on
123
123
124
124
### HTTP Publish(preview)
125
125
126
-
HTTP Publish enables applications to publish MQTT messages to Azure Event Grid MQTT Broker over a simple HTTPS POST request, without maintaining an active MQTT session. It’s best suited for scenarios where MQTT clients are not feasible or necessary—such as serverless functions, cloud services, or backend applications—allowing event-driven architectures to inject MQTT messages reliably and securely. Common use cases include publishing device commands, alerts, or control signals from Azure Functions, Logic Apps, or API integrations.
126
+
HTTP Publish enables applications to publish MQTT messages to Azure Event Grid MQTT Broker over a simple HTTPS POST request, without maintaining an active MQTT session. It’s best suited for scenarios where MQTT clients are not feasible or necessary—such as serverless functions, cloud services, or backend applications—allowing event-driven architectures to inject MQTT messages reliably and securely. Common use cases include publishing device commands, alerts, or control signals from Azure Functions, Logic Apps, or API integrations. For more information, see [HTTP Publish of MQTT messages in Azure Event Grid](mqtt-http-publish.md).
127
127
128
128
## Concepts
129
129
See the following articles for concepts of MQTT broker in Azure Event Grid:
Copy file name to clipboardExpand all lines: articles/event-grid/mqtt-retain.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@ ms.custom:
11
11
- ai-gen-description
12
12
---
13
13
14
-
##MQTT retain support in Azure Event Grid (preview)
14
+
# MQTT retain support in Azure Event Grid (preview)
15
15
The MQTT Retain feature in Azure Event Grid (Preview) ensures that the last known good value of a topic is stored and readily available for new subscribers. This capability allows new clients to instantly receive the most recent message upon connection, eliminating the need to wait for the next publish. It is beneficial in scenarios such as device state reporting, control signals, or configuration data, where timely access to the latest message is critical.
16
16
17
17
This article provides an overview of how the MQTT Retain feature works, its billing implications, storage limits, message deletion methods, and retain management considerations.
Copy file name to clipboardExpand all lines: articles/event-grid/overview.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -56,7 +56,7 @@ Here are some highlights of MQTT messaging support in Azure Event Grid:
56
56
- MQTT over WebSockets - Enable connectivity for clients in firewall-restricted environments.
57
57
- Custom domain names - Allows users to assign their own domain names to Event Grid namespace's MQTT endpoints, enhancing security and simplifying client configuration.
58
58
- Client Life Cycle events - Allow applications to react to events about the client connection status or the client resource operations.
59
-
-**HTTP Publish** - Enables devices and services to send MQTT messages to Azure Event Grid over HTTPS, simplifying integration with non-MQTT clients.
59
+
-[HTTP Publish](mqtt-http-publish.md) - Enables devices and services to send MQTT messages to Azure Event Grid over HTTPS, simplifying integration with non-MQTT clients.
60
60
-[MQTT Retain](mqtt-retain.md) - Ensures the last known message on a topic is automatically delivered to new subscribers, enabling instant state synchronization.
61
61
62
62
For more information about MQTT broker, see the following articles:
Copy file name to clipboardExpand all lines: articles/event-grid/whats-new.md
+4-3Lines changed: 4 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,12 +16,13 @@ The following features of Event Grid Namespaces moved from public preview to gen
16
16
17
17
-[OAuth 2.0 (JSON Web Token) authentication ( Refresh- with Direct upload of (Privacy-Enhanced Mail) PEM certificates)](authenticate-with-namespaces-using-json-web-tokens.md#configure-oauth-20-jwt-authentication-settings-on-your-event-grid-namespace---direct-upload)
-[HTTP Publish of MQTT messages in Azure Event Grid](mqtt-http-publish.md).
25
+
25
26
26
27
## May 2025
27
28
The following features of Event Grid Namespaces moved from public preview to general availability (GA).
@@ -49,7 +50,7 @@ The following features are released in Preview:
49
50
-[OAuth 2.0 (JSON Web Token) authentication ( Refresh- with Direct upload of (Privacy-Enhanced Mail) PEM certificates)](authenticate-with-namespaces-using-json-web-tokens.md#configure-oauth-20-jwt-authentication-settings-on-your-event-grid-namespace---direct-upload)
0 commit comments