Skip to content

Commit 6af676e

Browse files
committed
Freshness
1 parent 41a740f commit 6af676e

File tree

2 files changed

+66
-48
lines changed

2 files changed

+66
-48
lines changed
Lines changed: 65 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,61 @@
11
---
2-
title: Event delivery, managed service identity, and private link
3-
description: This article describes how to enable managed service identity for an Azure Event Grid topic. Use it to forward events to supported destinations.
2+
title: Use Managed Identities to Deliver Events in Azure Event Grid
3+
description: Learn how to enable managed identities for Azure Event Grid topics and domains, and then use them to securely deliver events to destinations like Service Bus, Event Hubs, and Storage accounts.
4+
#customer intent: As a developer, I want to enable managed identities for Azure Event Grid topics so that I can securely deliver events to supported destinations.
45
ms.topic: how-to
5-
ms.custom: devx-track-azurecli
6-
ms.date: 12/12/2023
6+
ms.custom:
7+
- devx-track-azurecli
8+
- ai-gen-docs-bap
9+
- ai-gen-title
10+
- ai-seo-date:07/29/2025
11+
- ai-gen-description
12+
ms.date: 07/29/2025
713
---
814

9-
# Event delivery with a managed identity
10-
This article describes how to use a [managed service identity](/entra/identity/managed-identities-azure-resources/overview) for an Azure Event Grid system topic, custom topic, or domain. Use it to forward events to supported destinations such as Service Bus queues and topics, event hubs, and storage accounts.
11-
15+
# Use managed identities to deliver events in Azure Event Grid
16+
This article explains how to enable [managed service identities](/entra/identity/managed-identities-azure-resources/overview) for Azure Event Grid system topics, custom topics, and domains. It also explains how to use managed identities to deliver events to supported destinations, such as Service Bus queues and topics, event hubs, and storage accounts.
1217

1318
## Prerequisites
14-
1. Assign a system-assigned identity or a user-assigned identity to a system topic, a custom topic, or a domain.
15-
- For custom topics and domains, see [Enable managed identity for custom topics and domains](enable-identity-custom-topics-domains.md).
16-
- For system topics, see [Enable managed identity for system topics](enable-identity-system-topics.md)
17-
1. Add the identity to an appropriate role (for example, Service Bus Data Sender) on the destination (for example, a Service Bus queue). For detailed steps, see [Add identity to Azure roles on destinations](add-identity-roles.md)
1819

19-
> [!NOTE]
20-
> Currently, it's not possible to deliver events using [private endpoints](../private-link/private-endpoint-overview.md). For more information, see the [Private endpoints](#private-endpoints) section at the end of this article.
20+
1. Assign a system-assigned identity or user-assigned identity to a system topic, custom topic, or domain.
21+
22+
- For custom topics and domains, see [Enable managed identity for custom topics and domains](enable-identity-custom-topics-domains.md).
23+
- For system topics, see [Enable managed identity for system topics](enable-identity-system-topics.md).
24+
25+
1. Add the identity to an appropriate role, such as Service Bus Data Sender, on the destination, such as a Service Bus queue. For detailed steps, see [Add identity to Azure roles on destinations](add-identity-roles.md).
26+
27+
> [!NOTE]
28+
> Currently, it's not possible to deliver events using [private endpoints](../private-link/private-endpoint-overview.md). For more information, see the [Private endpoints](#private-endpoints) section at the end of this article.
2129
2230
## Create event subscriptions that use an identity
23-
After you have an Event Grid custom topic or system topic or domain with a managed identity and have added the identity to the appropriate role on the destination, you're ready to create subscriptions that use the identity.
31+
32+
After you set up an Event Grid custom topic, system topic, or domain with a managed identity and add the identity to the appropriate role on the destination, you're ready to create subscriptions that use the identity.
2433

2534
### Use the Azure portal
26-
When you create an event subscription, you see an option to enable the use of a system-assigned identity or user-assigned identity for an endpoint in the **ENDPOINT DETAILS** section.
2735

28-
Here's an example of enabling system-assigned identity while creating an event subscription with a Service Bus queue as a destination.
36+
When you create an event subscription, you see an option to enable the use of a system-assigned identity or user-assigned identity for an endpoint in the **ENDPOINT DETAILS** section.
37+
38+
This example shows how to enable a system-assigned identity while creating an event subscription with a Service Bus queue as a destination.
2939

30-
:::image type="content" source="./media/managed-service-identity/service-bus-queue-subscription-identity.png" alt-text="Screenshot that shows how to enable an identity when creating an event subscription for a Service Bus queue.":::
40+
:::image type="content" source="./media/managed-service-identity/service-bus-queue-subscription-identity.png" alt-text="Screenshot showing how to enable a system-assigned identity for a Service Bus queue subscription.":::
3141

32-
You can also enable using a system-assigned identity to be used for dead-lettering on the **Additional Features** tab.
42+
You can also enable a system-assigned identity for dead-lettering on the **Additional Features** tab.
3343

34-
![Screenshot that shows how to enable a system-assigned identity for dead-lettering.](./media/managed-service-identity/enable-deadletter-identity.png)
44+
:::image type="content" source="./media/managed-service-identity/enable-deadletter-identity.png" alt-text="Screenshot of enabling a system-assigned identity for dead-lettering.":::
3545

36-
You can enable a managed identity on an event subscription after it's created. On the **Event Subscription** page for the event subscription, switch to the **Additional Features** tab to see the option. You can also enable identity for dead-lettering on this page.
46+
Enable a managed identity on an event subscription after it's created. On the **Event Subscription** page for the event subscription, switch to the **Additional Features** tab to see the option. You can also enable identity for dead-lettering on this page.
3747

38-
:::image type="content" source="./media/managed-service-identity/event-subscription-additional-features.png" alt-text="Screenshot that shows how to enable a system-assigned identity on an existing event subscription.":::
48+
:::image type="content" source="./media/managed-service-identity/event-subscription-additional-features.png" alt-text="Screenshot of enabling a system-assigned identity on an existing event subscription.":::
3949

40-
If you had enabled user-assigned identities for the topic, you'll see user-assigned identity option enabled in the drop-down list for **Managed Identity Type**. If you select **User Assigned** for **Managed Identity Type**, you can then select the user-assigned identity that you want to use to deliver events.
50+
If you enable user-assigned identities for the topic, you see the user-assigned identity option enabled in the drop-down list for **Managed Identity Type**. If you select **User Assigned** for **Managed Identity Type**, you can then select the user-assigned identity that you want to use to deliver events.
4151

42-
:::image type="content" source="./media/managed-service-identity/event-subscription-user-identity.png" alt-text="Screenshot that shows how to enable a user-assigned identity on an event subscription.":::
52+
:::image type="content" source="./media/managed-service-identity/event-subscription-user-identity.png" alt-text="Screenshot of enabling a user-assigned identity on an event subscription.":::
4353

44-
### Use the Azure CLI - Service Bus queue
45-
In this section, you learn how to use the Azure CLI to enable the use of a system-assigned identity to deliver events to a Service Bus queue. The identity must be a member of the **Azure Service Bus Data Sender** role. It must also be a member of the **Storage Blob Data Contributor** role on the storage account that's used for dead-lettering.
54+
### Use the Azure CLI
55+
56+
In this section, you learn how to use the Azure CLI to enable the use of a system-assigned identity to deliver events to a Service Bus queue. The identity must be a member of the **Azure Service Bus Data Sender** role and the **Storage Blob Data Contributor** role on the storage account used for dead-lettering.
4657

4758
#### Define variables
48-
First, specify values for the following variables to be used in the CLI command.
4959

5060
```azurecli-interactive
5161
subid="<AZURE SUBSCRIPTION ID>"
@@ -54,11 +64,12 @@ topicname = "<EVENT GRID TOPIC NAME>"
5464
5565
# get the service bus queue resource id
5666
queueid=$(az servicebus queue show --namespace-name <SERVICE BUS NAMESPACE NAME> --name <QUEUE NAME> --resource-group <RESOURCE GROUP NAME> --query id --output tsv)
57-
sb_esname = "<Specify a name for the event subscription>"
67+
sb_esname = "<Specify a name for the event subscription>"
5868
```
5969

60-
#### Create an event subscription by using a managed identity for delivery
61-
This sample command creates an event subscription for an Event Grid custom topic with an endpoint type set to **Service Bus queue**.
70+
#### Create an event subscription by using a managed identity for delivery
71+
72+
This command creates an event subscription for an Event Grid custom topic with the endpoint type set to **Service Bus queue**.
6273

6374
```azurecli-interactive
6475
az eventgrid event-subscription create
@@ -70,7 +81,8 @@ az eventgrid event-subscription create
7081
```
7182

7283
#### Create an event subscription by using a managed identity for delivery and dead-lettering
73-
This sample command creates an event subscription for an Event Grid custom topic with an endpoint type set to **Service Bus queue**. It also specifies that the system-managed identity is to be used for dead-lettering.
84+
85+
This sample command creates an event subscription for an Event Grid custom topic with an endpoint type set to **Service Bus queue**. It also specifies that the system-managed identity is to be used for dead-lettering.
7486

7587
```azurecli-interactive
7688
storageid=$(az storage account show --name demoStorage --resource-group gridResourceGroup --query id --output tsv)
@@ -86,21 +98,24 @@ az eventgrid event-subscription create
8698
-n $sb_esnameq
8799
```
88100

89-
### Use the Azure CLI - Event Hubs
90-
In this section, you learn how to use the Azure CLI to enable the use of a system-assigned identity to deliver events to an event hub. The identity must be a member of the **Azure Event Hubs Data Sender** role. It must also be a member of the **Storage Blob Data Contributor** role on the storage account that's used for dead-lettering.
101+
### Use the Azure CLI - Event Hubs
102+
103+
In this section, you learn how to use the Azure CLI to enable the use of a system-assigned identity to deliver events to an event hub. The identity must be a member of the **Azure Event Hubs Data Sender** role. It must also be a member of the **Storage Blob Data Contributor** role on the storage account that's used for dead-lettering.
91104

92105
#### Define variables
106+
93107
```azurecli-interactive
94108
subid="<AZURE SUBSCRIPTION ID>"
95109
rg = "<RESOURCE GROUP of EVENT GRID CUSTOM TOPIC>"
96110
topicname = "<EVENT GRID CUSTOM TOPIC NAME>"
97111
98112
hubid=$(az eventhubs eventhub show --name <EVENT HUB NAME> --namespace-name <NAMESPACE NAME> --resource-group <RESOURCE GROUP NAME> --query id --output tsv)
99-
eh_esname = "<SPECIFY EVENT SUBSCRIPTION NAME>"
113+
eh_esname = "<SPECIFY EVENT SUBSCRIPTION NAME>"
100114
```
101115

102-
#### Create an event subscription by using a managed identity for delivery
103-
This sample command creates an event subscription for an Event Grid custom topic with an endpoint type set to **Event Hubs**.
116+
#### Create an event subscription by using a managed identity for delivery
117+
118+
This sample command creates an event subscription for an Event Grid custom topic with an endpoint type set to **Event Hubs**.
104119

105120
```azurecli-interactive
106121
az eventgrid event-subscription create
@@ -111,8 +126,9 @@ az eventgrid event-subscription create
111126
-n $sbq_esname
112127
```
113128

114-
#### Create an event subscription by using a managed identity for delivery + deadletter
115-
This sample command creates an event subscription for an Event Grid custom topic with an endpoint type set to **Event Hubs**. It also specifies that the system-managed identity is to be used for dead-lettering.
129+
#### Create an event subscription by using a managed identity for delivery + deadletter
130+
131+
This sample command creates an event subscription for an Event Grid custom topic with an endpoint type set to **Event Hubs**. It also specifies that the system-managed identity is to be used for dead-lettering.
116132

117133
```azurecli-interactive
118134
storageid=$(az storage account show --name demoStorage --resource-group gridResourceGroup --query id --output tsv)
@@ -128,10 +144,11 @@ az eventgrid event-subscription create
128144
-n $eh_esname
129145
```
130146

131-
### Use the Azure CLI - Azure Storage queue
147+
### Use the Azure CLI - Azure Storage queue
148+
132149
In this section, you learn how to use the Azure CLI to enable the use of a system-assigned identity to deliver events to an Azure Storage queue. The identity must be a member of the **Storage Queue Data Message Sender** role on the storage account. It must also be a member of the **Storage Blob Data Contributor** role on the storage account that's used for dead-lettering.
133150

134-
#### Define variables
151+
#### Define variables
135152

136153
```azurecli-interactive
137154
subid="<AZURE SUBSCRIPTION ID>"
@@ -142,12 +159,12 @@ topicname = "<EVENT GRID CUSTOM TOPIC NAME>"
142159
storageid=$(az storage account show --name <STORAGE ACCOUNT NAME> --resource-group <RESOURCE GROUP NAME> --query id --output tsv)
143160
144161
# build the resource id for the queue
145-
queueid="$storageid/queueservices/default/queues/<QUEUE NAME>"
162+
queueid="$storageid/queueservices/default/queues/<QUEUE NAME>"
146163
147-
sa_esname = "<SPECIFY EVENT SUBSCRIPTION NAME>"
164+
sa_esname = "<SPECIFY EVENT SUBSCRIPTION NAME>"
148165
```
149166

150-
#### Create an event subscription by using a managed identity for delivery
167+
#### Create an event subscription by using a managed identity for delivery
151168

152169
```azurecli-interactive
153170
az eventgrid event-subscription create
@@ -158,7 +175,7 @@ az eventgrid event-subscription create
158175
-n $sa_esname
159176
```
160177

161-
#### Create an event subscription by using a managed identity for delivery + deadletter
178+
#### Create an event subscription by using a managed identity for delivery + deadletter
162179

163180
```azurecli-interactive
164181
storageid=$(az storage account show --name demoStorage --resource-group gridResourceGroup --query id --output tsv)
@@ -175,12 +192,13 @@ az eventgrid event-subscription create
175192
```
176193

177194
## Private endpoints
178-
Currently, it's not possible to deliver events using [private endpoints](../private-link/private-endpoint-overview.md). That is, there's no support if you have strict network isolation requirements where your delivered events traffic must not leave the private IP space.
179195

180-
However, if your requirements call for a secure way to send events using an encrypted channel and a known identity of the sender (in this case, Event Grid) using public IP space, you could deliver events to Event Hubs, Service Bus, or Azure Storage service using an Azure Event Grid custom topic or a domain with a managed identity as shown in this article. Then, you can use a private link configured in Azure Functions or your webhook deployed on your virtual network to pull events. See the tutorial: [Connect to private endpoints with Azure Functions](../azure-functions/functions-create-vnet.md).
196+
Currently, it's not possible to deliver events using [private endpoints](../private-link/private-endpoint-overview.md). That is, there's no support if you have strict network isolation requirements where your delivered events traffic must not leave the private IP space.
181197

182-
Under this configuration, the traffic goes over the public IP/internet from Event Grid to Event Hubs, Service Bus, or Azure Storage, but the channel can be encrypted and a managed identity of Event Grid is used. If you configure your Azure Functions or webhook deployed to your virtual network to use an Event Hubs, Service Bus, or Azure Storage via private link, that section of the traffic will evidently stay within Azure.
198+
However, if your requirements call for a secure way to send events using an encrypted channel and a known identity of the sender (in this case, Event Grid) using public IP space, you could deliver events to Event Hubs, Service Bus, or Azure Storage service using an Azure Event Grid custom topic or a domain with a managed identity as shown in this article. You can then use a private link configured in Azure Functions or a webhook deployed on your virtual network to pull events. See the tutorial: [Connect to private endpoints with Azure Functions](../azure-functions/functions-create-vnet.md).
183199

200+
Under this configuration, the traffic goes over the public IP/internet from Event Grid to Event Hubs, Service Bus, or Azure Storage, but the channel can be encrypted and a managed identity of Event Grid is used. If you configure Azure Functions or a webhook deployed to your virtual network to use Event Hubs, Service Bus, or Azure Storage via private link, that section of the traffic stays within Azure.
184201

185202
## Next steps
186-
To learn about managed identities, see [What are managed identities for Azure resources](/entra/identity/managed-identities-azure-resources/overview).
203+
204+
To learn about managed identities, see [what are managed identities for Azure resources](/entra/identity/managed-identities-azure-resources/overview).

articles/event-grid/subscribe-to-graph-api-events.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ Web application samples are available for the following languages:
236236
- [Node.js sample](https://github.com/microsoftgraph/nodejs-webhooks-sample).
237237
238238
> [!IMPORTANT]
239-
> You need to activate your partner topic that is created as part of your Graph API subscription creation. You also need to create an Event Grid event subscription to your web application to receive events. To that end, you use the URL configured in your web application to receive events as a webhook endpoint in your event subscription. [Next steps](#next-steps) for more information.
239+
> You need to activate your partner topic that is created as part of your Graph API subscription creation. You also need to create an Event Grid event subscription to your web application to receive events. To that end, you use the URL configured in your web application to receive events as a webhook endpoint in your event subscription.
240240
241241
> [!IMPORTANT]
242242
> Need sample code for another language or have questions? Email [[email protected]](mailto:[email protected]?subject=Need%20support%20for%20sample%20in%20other%20language).

0 commit comments

Comments
 (0)