Skip to content

Commit fd28a18

Browse files
Merge pull request #293665 from Connected-Seth/azure-docs-pr
Documentation Updates for Custom JWT Authentication - Event Grid MQTT Broker
2 parents c546a4e + fa9dbb6 commit fd28a18

File tree

5 files changed

+94
-15
lines changed

5 files changed

+94
-15
lines changed

articles/event-grid/authenticate-with-namespaces-using-json-web-tokens.md

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ title: Authenticate with namespaces using JSON Web Tokens
33
description: This article shows you how to authenticate with Azure Event Grid namespace using JSON Web Tokens.
44
ms.topic: how-to
55
ms.custom: build-2024, devx-track-azurecli
6-
ms.date: 05/21/2024
7-
author: george-guirguis
8-
ms.author: geguirgu
6+
ms.date: 01/27/2025
7+
author: Connected-Seth
8+
ms.author: seshanmugam
99
---
1010

1111
# Authenticate with namespaces using JSON Web Tokens
@@ -110,7 +110,25 @@ Use the following command to update your namespace with the custom JWT authentic
110110
111111
112112
```azurecli-interactive
113-
az resource update --resource-type Microsoft.EventGrid/namespaces --api-version 2024-06-01-preview --ids /subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourceGroups/dummy-cd-test/providers/Microsoft.EventGrid/namespaces/dummy-cd-test2 --set properties.topicSpacesConfiguration.clientAuthentication='{\"customJwtAuthentication\":{\"tokenIssuer\":\"dmpypin-issuer\",\"issuerCertificates\":[{\"certificateUrl\":\"https://dummyCert-cd-test.vault.azure.net/certificates/dummy-cd-test/4f844b284afd487e9bba0831191087br1\",\"identity\":{\"type\":\"SystemAssigned\"}}]}}'
113+
az resource update \
114+
--resource-type Microsoft.EventGrid/namespaces \
115+
--api-version 2024-06-01-preview \
116+
--ids /subscriptions/1111a1a1-bb2b-cc3c-dd4d-ffffee5e5e5e/resourceGroups/sample-rg/providers/Microsoft.EventGrid/namespaces/sample-namespace \
117+
--set properties.topicSpacesConfiguration.clientAuthentication='{
118+
\"customJwtAuthentication\":{
119+
\"tokenIssuer\":\"sample-issuer\",
120+
\"issuerCertificates\":[
121+
{
122+
\"certificateUrl\":\"https://sample-vault.vault.azure.net/certificates/sample-cert/12345abcdef67890\",
123+
\"identity\":{
124+
\"type\":\"UserAssigned\",
125+
\"userAssignedIdentity\":\"/subscriptions/1111a1a1-bb2b-cc3c-dd4d-ffffee5e5e5e/resourceGroups/sample-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/sample-identity\"
126+
}
127+
}
128+
]
129+
}
130+
}'
131+
114132
```
115133
## JSON Web Token format
116134
Json Web Tokens are divided into the JWT Header and JWT payload sections.
@@ -168,3 +186,4 @@ Event Grid maps all claims to client attributes if they have one of the followin
168186

169187
## Related content
170188
- [MQTT client authentication](mqtt-client-authentication.md)
189+
- [Authenticate client using custom JWT](mqtt-client-custom-jwt.md)

articles/event-grid/mqtt-client-authentication.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
title: 'Azure Event Grid Namespace MQTT client authentication'
33
description: 'Describes how MQTT clients are authenticated and mTLS connection is established when a client connects to Azure Event Grid’s MQTT broker feature.'
44
ms.topic: concept-article
5-
ms.date: 01/21/2025
6-
author: george-guirguis
7-
ms.author: geguirgu
5+
ms.date: 01/27/2025
6+
author: Connected-Seth
7+
ms.author: seshanmugam
88
ms.subservice: mqtt
99
# Customer intent: I want to learn about different types of authentication that MQTT broker in Azure Event Grid supports.
1010
---
@@ -14,15 +14,20 @@ ms.subservice: mqtt
1414
Azure Event Grid's MQTT broker supports the following authentication modes.
1515

1616
- Certificate-based authentication
17-
- Microsoft Entra ID authentication
17+
- Microsoft Entra ID authentication
18+
- Custom JWT authentication
1819

1920
## Certificate-based authentication
2021
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).
2122

2223
## Microsoft Entra ID authentication
2324
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).
2425

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)
28+
2529
## Related content
2630
- Learn how to [authenticate clients using certificate chain](mqtt-certificate-chain-client-authentication.md)
2731
- 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)
2833
- See [Transport layer security with MQTT broker](mqtt-transport-layer-security-flow.md)
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
title: Custom JWT authentication
3+
description: Describes custom JWT authentication and authorization to publish or subscribe to MQTT messages
4+
ms.topic: conceptual
5+
ms.custom: build-2024
6+
ms.date: 01/27/2025
7+
author: Connected-Seth
8+
ms.author: seshanmugam
9+
ms.subservice: mqtt
10+
---
11+
12+
# Custom JWT authentication and authorization to publish or subscribe to MQTT messages
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 token to authorize publish or subscribe permissions to your Event Grid topic spaces.
15+
16+
> [!IMPORTANT]
17+
> - This feature is supported only when using the MQTT v5 protocol version.
18+
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)
21+
22+
<a name='authentication-using-azure-ad-jwt'></a>
23+
24+
## Authentication using Custom JWT
25+
You can use the MQTT v5 CONNECT packet to provide the Custom JWT token 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 token |
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 token |
43+
| Authentication Reason Code | 25 |
44+
45+
Authenticate Reason Code with value 25 signifies reauthentication.
46+
47+
> [!NOTE]
48+
> - Audience: 'aud' claim must be set to "https://eventgrid.azure.net/".
49+
50+
## Access permissions
51+
A client using Custom JWT authentication can use client attributes and permissions to limit access to specific topics.
52+
53+
## Next steps
54+
- See [Publish and subscribe to MQTT message using Event Grid](mqtt-publish-and-subscribe-portal.md)
55+
- How to [Authenticate with namespaces using JSON Web Tokens](authenticate-with-namespaces-using-json-web-tokens.md)

articles/event-grid/mqtt-client-microsoft-entra-token-and-rbac.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@
22
title: Microsoft Entra `JWT` authentication and RBAC authorization for clients with Microsoft Entra identity
33
description: Describes JWT authentication and RBAC roles to authorize clients with Microsoft Entra identity to publish or subscribe MQTT messages
44
ms.topic: conceptual
5-
ms.custom:
6-
- ignite-2023
7-
ms.date: 11/15/2023
8-
author: george-guirguis
9-
ms.author: geguirgu
5+
ms.custom: build-2024
6+
ms.date: 01/27/2025
7+
author: Connected-Seth
8+
ms.author: seshanmugam
109
ms.subservice: mqtt
1110
---
1211

@@ -16,7 +15,6 @@ You can authenticate MQTT clients with Microsoft Entra JWT to connect to Event G
1615

1716
> [!IMPORTANT]
1817
> - This feature is supported only when using MQTT v5 protocol version
19-
> - JWT authentication is supported for Managed Identities and Service principals only
2018
2119
## Prerequisites
2220
- 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)

articles/event-grid/toc.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,10 @@ items:
7777
href: oauth-json-web-token-authentication.md
7878
- name: MQTT client authentication using certificates
7979
href: mqtt-client-certificate-authentication.md
80-
- name: JWT authentication and RBAC authorization for clients with Microsoft Entra identity
80+
- name: Microsoft Entra JWT authentication and RBAC authorization for clients
8181
href: mqtt-client-microsoft-entra-token-and-rbac.md
82+
- name: OAuth 2.0 JSON Web Token authentication and authorization for clients
83+
href: mqtt-client-custom-jwt.md
8284
- name: Transport Layer Security connection with MQTT broker
8385
href: mqtt-transport-layer-security-flow.md
8486
- name: Reliability

0 commit comments

Comments
 (0)