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
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.
4
5
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
7
13
---
8
14
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.
12
17
13
18
## 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)
18
19
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.
21
29
22
30
## 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.
24
33
25
34
### 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.
27
35
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.
29
39
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.":::
31
41
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.
33
43
34
-

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.":::
35
45
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.
37
47
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.":::
39
49
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.
41
51
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.":::
43
53
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.
46
57
47
58
#### Define variables
48
-
First, specify values for the following variables to be used in the CLI command.
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>"
58
68
```
59
69
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**.
62
73
63
74
```azurecli-interactive
64
75
az eventgrid event-subscription create
@@ -70,7 +81,8 @@ az eventgrid event-subscription create
70
81
```
71
82
72
83
#### 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.
74
86
75
87
```azurecli-interactive
76
88
storageid=$(az storage account show --name demoStorage --resource-group gridResourceGroup --query id --output tsv)
@@ -86,21 +98,24 @@ az eventgrid event-subscription create
86
98
-n $sb_esnameq
87
99
```
88
100
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.
91
104
92
105
#### Define variables
106
+
93
107
```azurecli-interactive
94
108
subid="<AZURE SUBSCRIPTION ID>"
95
109
rg = "<RESOURCE GROUP of EVENT GRID CUSTOM TOPIC>"
96
110
topicname = "<EVENT GRID CUSTOM TOPIC NAME>"
97
111
98
112
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>"
100
114
```
101
115
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**.
104
119
105
120
```azurecli-interactive
106
121
az eventgrid event-subscription create
@@ -111,8 +126,9 @@ az eventgrid event-subscription create
111
126
-n $sbq_esname
112
127
```
113
128
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.
116
132
117
133
```azurecli-interactive
118
134
storageid=$(az storage account show --name demoStorage --resource-group gridResourceGroup --query id --output tsv)
@@ -128,10 +144,11 @@ az eventgrid event-subscription create
128
144
-n $eh_esname
129
145
```
130
146
131
-
### Use the Azure CLI - Azure Storage queue
147
+
### Use the Azure CLI - Azure Storage queue
148
+
132
149
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.
#### Create an event subscription by using a managed identity for delivery
167
+
#### Create an event subscription by using a managed identity for delivery
151
168
152
169
```azurecli-interactive
153
170
az eventgrid event-subscription create
@@ -158,7 +175,7 @@ az eventgrid event-subscription create
158
175
-n $sa_esname
159
176
```
160
177
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
162
179
163
180
```azurecli-interactive
164
181
storageid=$(az storage account show --name demoStorage --resource-group gridResourceGroup --query id --output tsv)
@@ -175,12 +192,13 @@ az eventgrid event-subscription create
175
192
```
176
193
177
194
## 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.
179
195
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.
181
197
182
-
Under this configuration, the traffic goes over the public IP/internet from Event Gridto 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).
183
199
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.
184
201
185
202
## 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).
> 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.
240
240
241
241
> [!IMPORTANT]
242
242
> 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