Skip to content

Commit 4c323b7

Browse files
Merge pull request #313552 from spelluru/egridupdtes0323
Event Grid updates
2 parents 84263b4 + d9621ed commit 4c323b7

6 files changed

Lines changed: 556 additions & 4 deletions

File tree

articles/event-grid/authenticate-with-namespaces-using-webhook-authentication.md

Lines changed: 54 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: This article shows you how to authenticate with Azure Event Grid na
44
ms.topic: how-to
55
ms.custom:
66
- build-2025
7-
ms.date: 07/30/2025
7+
ms.date: 03/23/2026
88
author: Connected-Seth
99
ms.author: seshanmugam
1010
---
@@ -47,6 +47,40 @@ az eventgrid namespace update --resource-group <resource group name> --name <nam
4747

4848
For information on how to configure system and user-assigned identities by using the Azure portal, see [Enable managed identity for an Event Grid namespace](event-grid-namespace-managed-identity.md).
4949

50+
## Implementations
51+
52+
### Option 1: Webhook Via Azure Functions implementation (Microsoft Entra App)
53+
54+
Azure Functions can host the webhook logic using `Microsoft.Identity.Web` to validate token automatically. We need Microsoft Entra app registration for Webhook API for validating Event Grid caller tokens, which has an Application ID URI for token issuance. Client side (Event Grid) already has managed identity.
55+
56+
**Pros:**
57+
58+
- No infrastructure to manage
59+
- Built-in authentication helpers (`Microsoft.Identity.Web`)
60+
- Durable, scalable, cost-efficient
61+
62+
Function must do the following operations:
63+
64+
- Validate caller token from Event Grid Managed Identity
65+
- Validate client Json Web Token (JWT)
66+
- Return allow or deny JSON
67+
68+
### Option 2: External HTTPS endpoint implementation
69+
70+
This implementation can be any external HTTPS Endpoint (any cloud, any backend), using Microsoft Entra ID JWT validation with `Microsoft.IdentityModel` libraries.
71+
72+
Use any runtime: .NET / Node / Java / Python.
73+
74+
Key requirements:
75+
76+
- Must be HTTPS
77+
- Must validate caller JWT
78+
- Must validate device JWT
79+
- Must respond within timeout (~5 sec recommended)
80+
81+
:::image type="content" source="./media/authenticate-with-namespaces-using-webhook-authentication/custom-webhook-implementations.svg" alt-text="Diagram that shows custom webhook implementations." lightbox="./media/authenticate-with-namespaces-using-webhook-authentication/custom-webhook-implementations.svg":::
82+
83+
5084
## Grant the managed identity appropriate access to a function or webhook
5185

5286
Grant the managed identity of your Event Grid namespace the appropriate access to the target Azure function or webhook.
@@ -131,7 +165,11 @@ Replace `<NAMESPACE_NAME>` and `<RESOURCE_GROUP_NAME>` with your actual values.
131165

132166
### Request headers
133167

168+
Azure Event Grid sends the following headers in the request to the webhook:
169+
170+
```
134171
**Authorization**: Bearer token
172+
```
135173

136174
The token is a Microsoft Entra token for the managed identity that was configured to call the webhook.
137175

@@ -158,9 +196,8 @@ The token is a Microsoft Entra token for the managed identity that was configure
158196
| `password` | Optional | Password from MQTT CONNECT packet in Base64 encoding. |
159197
| `authenticationMethod` | Optional | Authentication method from MQTT CONNECT packet (MQTT5 only). |
160198
| `authenticationData` | Optional | Authentication data from MQTT CONNECT packet in Base64 encoding (MQTT5 only). |
161-
| `clientCertificate` | Optional | Client certificate in PEM format. |
199+
| `clientCertificate` | Optional | Client certificate in Privacy-Enhanced Mail (PEM) format. |
162200
| `clientCertificateChain`| Optional | Other certificates provided by the client required to build the chain from the client certificate to the Certificate Authority certificate. |
163-
| `userProperties` | Optional | User properties from CONNECT packet (MQTT5 only). |
164201

165202
### Response payload
166203

@@ -193,6 +230,20 @@ Content-Type: application/json
193230
}
194231
```
195232

233+
**Error codes:**
234+
235+
236+
237+
| Authentication Outcome | Function response | Event Grid MQTT reason code |
238+
|------------------------|-----------------|------------------|
239+
| Explicit authorization denial | `"decision": "deny"` | Not authorized |
240+
| Invalid / expired token | `"decision": "deny"` | Not authorized |
241+
| Function timeout | N/A | Server unavailable |
242+
| Function exception / crash | N/A | Server unavailable |
243+
| Transient platform failure | N/A | Server unavailable |
244+
| Internal broker processing error | N/A | Server unavailable |
245+
246+
196247
### Response field descriptions
197248

198249
| Field | Description |

0 commit comments

Comments
 (0)