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/authenticate-with-namespaces-using-json-web-tokens.md
+96-15Lines changed: 96 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,34 +3,33 @@ title: Authenticate with namespaces using JSON Web Tokens
3
3
description: This article shows you how to authenticate with Azure Event Grid namespace using JSON Web Tokens.
4
4
ms.topic: how-to
5
5
ms.custom: build-2024, devx-track-azurecli
6
-
ms.date: 01/27/2025
6
+
ms.date: 04/30/2025
7
7
author: Connected-Seth
8
8
ms.author: seshanmugam
9
9
---
10
10
11
-
# Authenticate with namespaces using JSON Web Tokens
12
-
This article shows how to authenticate with Azure Event Grid namespace using JSON Web Tokens.
11
+
# Use OAuth 2.0 JSON Web Tokens (JWT) to authenticate with namespaces
12
+
This article shows how to authenticate with Azure Event Grid namespace using OAuth 2.0 JSON Web Tokens.
13
13
14
-
Azure Event Grid's MQTT broker supports custom JWT authentication, which enables clients to connect and authenticate with an Event Grid namespace using JSON Web Tokens that are issued by any identity provider, aside from Microsoft Entra ID.
14
+
Azure Event Grid's MQTT broker supports OAuth 2.0 JWT authentication, which enables clients to connect and authenticate with an Event Grid namespace using JSON Web Tokens that are issued by any identity provider, aside from Microsoft Entra ID.
15
15
16
16
## Prerequisites
17
17
18
-
To use custom JWT authentication for namespaces, you need to have the following prerequisites:
18
+
To use OAuth 2.0 JWT authentication for namespaces, you need to have the following prerequisites:
19
19
20
20
- Identity provider that can issue JSON Web Tokens.
21
-
- CA certificate that includes your public keys used to validate the client tokens.
22
-
- Azure Key Vault account to host the CA certificate that includes your public keys.
21
+
- CA certificate that includes your public keys used to validate the client tokens(Key Vault) or PEM file of your public key certificates(direct upload).
23
22
24
23
## High-level steps
25
24
26
-
To use custom JWT authentication for namespaces, follow these steps:
25
+
To use OAuth 2.0 JWT authentication for namespaces, follow these steps:
27
26
28
-
1. Create a namespace and configure its subresources.
27
+
1. Create a namespace and configure its subresources.
29
28
1. Enable managed identity on your Event Grid namespace.
30
-
1.Create an Azure Key Vault account that hosts the CA certificate that includes your public keys.
31
-
1.Add role assignment in Azure Key Vault for the namespace’s managed identity.
32
-
1.Configure custom authentication settings on your Event Grid namespace
33
-
1. Your clients can connect to the Event Grid namespace using the tokens provided by your identity provider.
29
+
1.Configure OAuth 2.0 authentication settings on your Event Grid namespace by following these steps:
30
+
1.Create an Azure Key Vault account that hosts the CA certificate that includes your public keys and add role assignment in Key Vault for the namespace’s managed identity.
31
+
1.Upload the PEM file of your public key certificates to namespace.
32
+
1. Your clients can connect to the Event Grid namespace using the tokens provided by your identity provider.
34
33
35
34
## Create a namespace and configure its subresources
36
35
Follow instructions from [Quickstart: Publish and subscribe to MQTT messages on Event Grid Namespace with Azure portal](mqtt-publish-and-subscribe-portal.md) to create a namespace and configure its subresources. Skip the certificate and client creation steps as the client identities come from the provided token. Client attributes are based on the custom claims in the client token. The client attributes are used in the client group query, topic template variables, and routing enrichment configuration.
@@ -81,7 +80,7 @@ You need to provide access to the namespace to access your Azure Key Vault accou
81
80
82
81
For more information about Key Vault access and the portal experience, see [Provide access to Key Vault keys, certificates, and secrets with an Azure role-based access control](/azure/key-vault/general/rbac-guide).
83
82
84
-
## Configure custom authentication settings on your Event Grid namespace
83
+
## Configure OAuth 2.0 JWT authentication settings on your Event Grid namespace -Key Vault
85
84
In this step, you configure custom authentication settings on your Event Grid namespace using Azure portal and Azure CLI. You need to create the namespace first then update it using the following steps.
86
85
87
86
### Use Azure portal
@@ -130,7 +129,7 @@ az resource update \
130
129
}'
131
130
132
131
```
133
-
## JSON Web Token format
132
+
###JSON Web Token format
134
133
JSON Web Tokens are divided into the JWT Header and JWT payload sections.
135
134
136
135
### JWT Header
@@ -184,6 +183,88 @@ Event Grid maps all claims to client attributes if they have one of the followin
184
183
}
185
184
```
186
185
186
+
## Configure OAuth 2.0 JWT authentication settings on your Event Grid namespace - Direct upload
187
+
188
+
In this step, you configure custom JWT authentication settings on your Event Grid namespace using Azure portal and Azure CLI. You need to create the namespace first then update it using the following steps.
189
+
190
+
## Use Azure portal
191
+
1. Navigate to your Event Grid namespace in the Azure portal.
192
+
1. On the Event Grid Namespace page, select Configuration on the left menu.
193
+
1. In the Custom JWT authentication section, specify values for the following properties:
194
+
1. Select **Enable custom JWT authentication**.
195
+
1.**Token Issuer**: Enter the value of the issuer claims of the JWTs, presented by the MQTT clients.
- Replace `<resource-group-name>`, `<namespace-name>`, `<location>`, `<key-vault-name>`, `<certificate-name>`, and `<certificate-in-PEM-format>` with your actual values.
224
+
- The encodedCertificate value must include the full certificate in PEM format, including headers ( `"-----BEGIN CERTIFICATE-----" and "-----END CERTIFICATE----`).
225
+
- Ensure the public key certificate provided is valid and trusted by your identity provider.
226
+
- Regularly update the encodedIssuerCertificates if certificates are rotated or expired.
227
+
228
+
### JSON Web Token format
229
+
230
+
JWT payload
231
+
232
+
Event Grid requires the following claims: `iss`, `sub`, `aud`, `exp`, `nbf`.
233
+
234
+
*`kid` is optional. If it is present, then certificate with matching `kid` is used for validation.
235
+
* List of standard claims that aren't used as attributes - `iss`, `sub`, `aud`, `exp`, `nbf`, `iat`, `jti`.
236
+
* All claims which have correct data type (number that fits int32, string, array of strings) are used as attributes. In the example `num_attr_pos`, `num_attr_neg`, `str_attr`, `str_list_attr` claims have correct data types and are used as attributes.
237
+
* In the example `bool_attr`, `num_attr_to_big`, `num_attr_float`, `obj_attr` claims have incorrect data types and aren't be used as attributes.
Copy file name to clipboardExpand all lines: articles/event-grid/mqtt-client-authentication.md
+6-4Lines changed: 6 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,19 +15,21 @@ Azure Event Grid's MQTT broker supports the following authentication modes.
15
15
16
16
- Certificate-based authentication
17
17
- Microsoft Entra ID authentication
18
-
-Custom JWT authentication
18
+
-OAuth 2.0 (JSON Web Token) authentication
19
19
20
20
## Certificate-based authentication
21
21
You can use Certificate Authority (CA) signed certificates or self-signed certificates to authenticate clients. For more information, see [MQTT Client authentication using certificates](mqtt-client-certificate-authentication.md).
22
22
23
23
## Microsoft Entra ID authentication
24
24
You can authenticate MQTT clients with Microsoft Entra JWT to connect to Event Grid namespace. You can use Azure role-based access control (Azure RBAC) to enable MQTT clients, with Microsoft Entra identity, to publish or subscribe access to specific topic spaces. For more information, see [Microsoft Entra JWT authentication and Azure RBAC authorization to publish or subscribe MQTT messages](mqtt-client-microsoft-entra-token-and-rbac.md).
25
25
26
-
## Custom JWT authentication
27
-
You can authenticate MQTT clients using JSON Web Tokens (JWT) issued by any third-party OpenID Connect (OIDC) identity provider. This authentication method provides a lightweight, secure, and flexible option for MQTT clients that aren't provisioned in Azure. For more information, see [authenticate client using custom JWT](mqtt-client-custom-jwt.md)
26
+
## OAuth 2.0 JWT authentication
27
+
You can authenticate MQTT clients using JSON Web Tokens (JWT) issued by any third-party OpenID Connect (OIDC) identity provider. This authentication method provides a lightweight, secure, and flexible option for MQTT clients that aren't provisioned in Azure. For more information, see [Authenticate client using OAuth 2.0 JWT](mqtt-client-custom-jwt.md).
28
+
29
+
28
30
29
31
## Related content
30
32
- Learn how to [authenticate clients using certificate chain](mqtt-certificate-chain-client-authentication.md)
31
33
- Learn how to [authenticate client using Microsoft Entra ID token](mqtt-client-azure-ad-token-and-rbac.md)
32
-
- Learn how to[authenticate client using custom JWT](mqtt-client-custom-jwt.md)
34
+
- Learn how to[authenticate client using OAuth 2.0 JWT](mqtt-client-custom-jwt.md)
33
35
- See [Transport layer security with MQTT broker](mqtt-transport-layer-security-flow.md)
Copy file name to clipboardExpand all lines: articles/event-grid/mqtt-client-custom-jwt.md
+10-30Lines changed: 10 additions & 30 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,54 +1,34 @@
1
1
---
2
-
title: Custom JWT authentication
3
-
description: Describes custom JWT authentication and authorization to publish or subscribe to MQTT messages
2
+
title: OAuth 2.0 JWT authentication
3
+
description: Describes OAuth 2.0 JWT authentication and authorization to publish or subscribe to MQTT messages
4
4
ms.topic: conceptual
5
5
ms.custom: build-2024
6
-
ms.date: 01/27/2025
6
+
ms.date: 04/30/2025
7
7
author: Connected-Seth
8
8
ms.author: seshanmugam
9
9
ms.subservice: mqtt
10
10
---
11
11
12
-
# Custom JWT authentication and authorization to publish or subscribe to MQTT messages
12
+
# OAuth 2.0 JSON Web Token (JWT) authentication and authorization to publish or subscribe to MQTT messages
13
13
14
-
You can authenticate MQTT clients with Custom JWT to connect to the Event Grid namespace. You can embed and validate custom claims in the JWT to authorize publish or subscribe permissions to your Event Grid topic spaces.
14
+
You can authenticate MQTT clients with OAuth 2.0 JWT to connect to the Event Grid namespace. You can embed and validate custom claims in the JWT to authorize publish or subscribe permissions to your Event Grid topic spaces.
15
15
16
16
> [!IMPORTANT]
17
17
> - This feature is supported only when using the MQTT v5 protocol version.
18
18
19
19
## Prerequisites
20
-
- You need an Event Grid namespace with MQTT enabled. Learn about [creating Event Grid namespace](/azure/event-grid/create-view-manage-namespaces#create-a-namespace)
20
+
- You need an Event Grid namespace with MQTT enabled. Learn about [creating Event Grid namespace](/azure/event-grid/create-view-manage-namespaces#create-a-namespace)
21
21
22
22
<aname='authentication-using-azure-ad-jwt'></a>
23
23
24
-
## Authentication using Custom JWT
25
-
You can use the MQTT v5 CONNECT packet to provide the Custom JWT to authenticate your client and the MQTT v5 AUTH packet to refresh the token.
26
-
27
-
> [!IMPORTANT]
28
-
> - If you don't set the CONNECT packet's authentication method to CUSTOM-JWT, you receive an 'invalid issuer' error—even if all other configurations are correct.
29
-
30
-
In the CONNECT packet, you can provide the required values in the following fields:
31
-
32
-
|Field | Value |
33
-
|---------|---------|
34
-
|Authentication Method | CUSTOM-JWT |
35
-
|Authentication Data | JWT |
36
-
37
-
In the AUTH packet, you can provide the required values in the following fields:
38
-
39
-
|Field | Value |
40
-
|---------|---------|
41
-
| Authentication Method | CUSTOM-JWT |
42
-
| Authentication Data | JWT |
43
-
| Authentication Reason Code | 25 |
44
-
45
-
Authenticate Reason Code with value 25 signifies reauthentication.
24
+
## Authentication using OAuth 2.0 JWT
25
+
You can use the MQTT v5 CONNECT packet to provide the OAuth 2.0 JWT to authenticate your client and the MQTT v5 AUTH packet to refresh the token.
46
26
47
27
> [!NOTE]
48
-
> - Audience: 'aud' claim must be set to "https://eventgrid.azure.net/".
28
+
> - Audience: `aud` claim must be set to `https://[namespace].ts.eventgrid.azure.net/`.
49
29
50
30
## Access permissions
51
-
A client using Custom JWT authentication can use client attributes and permissions to limit access to specific topics.
31
+
A client using OAuth 2.0 JWT authentication can use client attributes and permissions to limit access to specific topics.
52
32
53
33
## Next steps
54
34
- See [Publish and subscribe to MQTT message using Event Grid](mqtt-publish-and-subscribe-portal.md)
Copy file name to clipboardExpand all lines: articles/event-grid/mqtt-events-fabric.md
+23-33Lines changed: 23 additions & 33 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,51 +2,41 @@
2
2
title: Send MQTT events to Microsoft Fabric via Event Hubs
3
3
description: Shows you how to use Event Grid to send events from MQTT clients to Microsoft Fabric via Azure Event Hubs.
4
4
ms.topic: how-to
5
-
ms.date: 02/13/2024
6
-
author: spelluru
7
-
ms.author: spelluru
5
+
ms.date: 04/30/2025
6
+
author: Connected-Seth
7
+
ms.author: seshanmugam
8
8
ms.subservice: mqtt
9
9
---
10
10
11
-
# How to send MQTT events to Microsoft Fabric via Event Hubs using Azure Event Grid
12
-
This article shows you how to use Azure Event Grid to send events from MQTT clients to Microsoft Fabric data stores via Azure Event Hubs.
11
+
# How to send MQTT events to Microsoft Fabric using Azure Event Grid (Preview)
12
+
This article shows you how to use Azure Event Grid to send events from MQTT clients to Microsoft Fabric eventstream.
13
13
14
14
## High-level steps
15
15
16
-
1. Create a namespace topic that receives events from MQTT clients.
17
-
2. Create a subscription to the topic using Event Hubs as the destination.
18
-
3. Create an event stream in Microsoft Fabric with the event hub as a source and a Fabric KQL database or Lakehouse as a destination.
19
-
20
-
## Event flow
21
-
22
-
1. MQTT client sends events to your Event Grid namespace topic.
23
-
2. Event subscription to the namespace topic forwards those events to your event hub.
24
-
3. Fabric event stream receives events from the event hub and stores them in a Fabric destination such as a KQL database or a lakehouse.
16
+
1. Create an Azure Event Grid namespace.
17
+
1. Create a namespace topic in the namespace that receives events from MQTT clients.
18
+
1. Enable managed identity on the Event Grid namespace.
19
+
1. Enable MQTT and routing on the Event Grid namespace, if you want to receive Message Queuing Telemetry Transport (MQTT) data.
20
+
1. Create an event stream in Microsoft Fabric.
25
21
26
22
## Detailed steps
27
23
28
-
1. Follow steps from the article: [Tutorial: Use namespace topics to route MQTT messages to Azure Event Hubs (Azure portal)](mqtt-routing-to-event-hubs-portal-namespace-topics.md) to:
29
-
1. Create an Event Grid namespace in the Azure portal.
30
-
1. Create a namespace topic.
31
-
1. Enable managed identity for the namespace.
32
-
1. Enable MQTT broker for the Event Grid namespace.
33
-
1. Create an Event Hubs namespace.
34
-
1. Create an event hub.
35
-
1. Grant Event Grid namespace the permission to send events to the event hub.
36
-
1. Create an event subscription to namespace topic with the event hub as the endpoint.
37
-
1. Configure routing for the Event Grid namespace.
24
+
1. Follow steps from the article: [QuickStart: Publish and subscribe to MQTT messages on Event Grid Namespace with Azure portal](mqtt-publish-and-subscribe-portal.md) to:
25
+
1. Create Event Grid namespace in the Azure portal.
26
+
1. Create a namespace topic.
27
+
1. Enable managed identity for the namespace.
28
+
1. Enable MQTT broker for the Event Grid namespace.
29
+
1. Configure routing for the Event Grid namespace.
38
30
1. Create clients, topic space, and permission bindings.
39
-
1. Use MQTTX tool to send a few test events or messages.
40
-
1. In Microsoft Fabric, do these steps:
41
-
1.[Create a lakehouse](/fabric/onelake/create-lakehouse-onelake#create-a-lakehouse).
42
-
2.[Create an event stream](/fabric/real-time-analytics/event-streams/create-manage-an-eventstream#create-an-eventstream).
43
-
3.[Add your event hub as an input source](/fabric/real-time-analytics/event-streams/add-manage-eventstream-sources#add-an-azure-event-hub-as-a-source).
44
-
4.[Add your lakehouse as a destination](/fabric/real-time-analytics/event-streams/add-manage-eventstream-destinations#add-a-lakehouse-as-a-destination).
45
-
1.[Publish events to the namespace topic](publish-deliver-events-with-namespace-topics.md#send-events-to-your-topic).
31
+
1. Use MQTTX tool to send a few test events or messages.
32
+
1. In Microsoft Fabric, follow the steps from the article: [Add Azure Event Grid Namespace source to an eventstream (Preview)](add-source-azure-event-grid.md)
33
+
1. Create workspace in Fabric.
34
+
1. Create an eventstream.
35
+
1. Create an Azure Event Grid namespace datasource.
36
+
1. Preview Data in the eventstream.
46
37
47
38
## Next steps
48
-
Build a Power BI report as shown in the sample: [Build a near-real-time Power BI report with the event data ingested in a lakehouse](/fabric/real-time-analytics/event-streams/transform-and-stream-real-time-events-to-lakehouse).
49
-
39
+
To learn how to add other sources to an eventstream, see the following article: [Add and manage an event source in an eventstream](add-manage-eventstream-sources.md).
Copy file name to clipboardExpand all lines: articles/event-grid/oauth-json-web-token-authentication.md
+7-9Lines changed: 7 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,11 +2,9 @@
2
2
title: Namespace authentication using JSON Web Tokens
3
3
description: This article describes authentication of Azure Event Grid namespaces using JSON Web Tokens.
4
4
ms.topic: how-to
5
-
ms.custom:
6
-
- build-2024
7
-
ms.date: 05/21/2024
8
-
author: george-guirguis
9
-
ms.author: geguirgu
5
+
ms.date: 04/30/2025
6
+
author: Connected-Seth
7
+
ms.author: seshanmugam
10
8
---
11
9
12
10
# OAuth 2.0 (JSON Web Token) authentication with Azure Event Grid namespaces
@@ -19,13 +17,13 @@ OAuth 2.0 (JSON Web Token) authentication allows clients to authenticate and con
19
17
20
18
## High-level steps
21
19
22
-
To use custom JWT authentication for namespaces, follow these steps:
20
+
To use OAuth 2.0 JWT authentication for namespaces, follow these steps:
23
21
24
22
1. Create a namespace and configure its subresources.
25
23
1. Enable managed identity on your Event Grid namespace.
26
-
1.Create an Azure Key Vault account that hosts the CA certificate that includes your public keys.
27
-
1.Add role assignment in Azure Key Vault for the namespace’s managed identity.
28
-
1.Configure custom authentication settings on your Event Grid namespace
24
+
1.Configure OAuth 2.0 authentication settings on your Event Grid namespace by following these steps:
25
+
1.Create an Azure **Key Vault** account that hosts the CA certificate that includes your public keys and add role assignment in Key Vault for the namespace’s managed identity.
26
+
1.Upload the Privacy-Enhanced Mail (PEM) file of your public key certificates to namespace.
29
27
1. Your clients can connect to the Event Grid namespace using the tokens provided by your identity provider.
0 commit comments