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/secure-webhook-delivery.md
+50-34Lines changed: 50 additions & 34 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,33 +2,47 @@
2
2
title: Secure WebHook delivery with Azure AD in Azure Event Grid
3
3
description: Describes how to deliver events to HTTPS endpoints protected by Azure Active Directory using Azure Event Grid
4
4
ms.topic: how-to
5
-
ms.date: 01/20/2022
5
+
ms.date: 10/12/2022
6
6
---
7
7
8
8
# Deliver events to Azure Active Directory protected endpoints
9
-
This article describes how to use Azure Active Directory (Azure AD) to secure the connection between your **event subscription** and your **webhook endpoint**. For an overview of Azure AD applications and service principals, see [Microsoft identity platform (v2.0) overview](../active-directory/develop/v2-overview.md).
10
-
11
-
This article uses the Azure portal for demonstration, however the feature can also be enabled using CLI, PowerShell, or the SDKs.
9
+
This article describes how to use Azure Active Directory (Azure AD) to secure the connection between your **event subscription** and your **webhook endpoint**. It uses the Azure portal for demonstration, however the feature can also be enabled using CLI, PowerShell, or the SDKs.
12
10
13
11
> [!IMPORTANT]
14
-
> Additional access check has been introduced as part of create or update of event subscription on March 30, 2021 to address a security vulnerability. The subscriber client's service principal needs to be either an owner or have a role assigned on the destination application service principal. Please reconfigure your Azure AD Application following the new instructions below.
12
+
> Additional access check has been introduced as part of create or update of event subscription on March 30, 2021 to address a security vulnerability. The subscriber client's service principal needs to be either an owner or have a role assigned on the destination application service principal. Reconfigure your Azure AD Application following the new instructions below.For an overview of Azure AD applications and service principals, see [Microsoft identity platform (v2.0) overview](../active-directory/develop/v2-overview.md).
13
+
14
+
## Scenarios
15
+
This article explains how to implement the following two scenarios in detail:
16
+
17
+
-[Delivering events to a webhook that is in the same Azure AD tenant as the event subscription](#deliver-events-to-a-webhook-in-the-same-azure-ad-tenant). You can use either an Azure AD user or an Azure AD application as the event subscription writer in this scenario.
18
+
-[Delivering events to a webhook that is in a different Azure AD tenant from the event subscription](#deliver-events-to-a-webhook-in-a-different-azure-ad-tenant). You can only use an Azure AD application as an event subscription writer in this scenario.
19
+
20
+
In the first scenario, you run all the steps or scripts in a single tenant that has both the event subscription and the webhook. And, in the second scenario, you run some steps in the tenant that has the event subscription and some steps in the tenant that has the webhook.
15
21
16
22
## Deliver events to a Webhook in the same Azure AD tenant
17
23
18
-

24
+
The following diagram depicts how Event Grid events are delivered to a webhook in the same tenant as the event subscription.
25
+
26
+
:::image type="content" source="./media/secure-webhook-delivery/single-tenant-diagram.png" alt-text="Image that depicts secure delivery of events to a webhook that's in the same tenant.":::
27
+
28
+
There are two subsections in this section. Read through both the scenarios or the one that you're interested in.
19
29
20
-
Based on the diagram above, follow the next steps to configure the tenant.
30
+
-[Configure the event subscription by using an Azure AD **user**](#configure-the-event-subscription-by-using-an-azure-ad-user)
31
+
-[Configure the event subscription by using an Azure AD **application**](#configure-the-event-subscription-by-using-an-azure-ad-application)
21
32
22
-
### Configure the event subscription by using Azure AD User
23
33
24
-
1. Create an Azure AD Application for the webhook configured to work with the Microsoft directory (Single tenant).
34
+
### Configure the event subscription by using an Azure AD user
35
+
36
+
This section shows how to configure the event subscription by using an Azure AD user.
37
+
38
+
1. Create an Azure AD application for the webhook configured to work with the Microsoft directory (single tenant).
25
39
26
40
2. Open the [Azure Shell](https://portal.azure.com/#cloudshell/) in the tenant and select the PowerShell environment.
27
41
28
42
3. Modify the value of **$webhookAadTenantId** to connect to the tenant.
@@ -38,11 +52,11 @@ Based on the diagram above, follow the next steps to configure the tenant.
38
52
4. Open the [following script](scripts/event-grid-powershell-webhook-secure-delivery-azure-ad-user.md) and update the values of **$webhookAppObjectId** and **$eventSubscriptionWriterUserPrincipalName** with your identifiers, thencontinue to run the script.
39
53
40
54
- Variables:
41
-
- **$webhookAppObjectId**: Azure AD Application ID created for the webhook
42
-
- **$eventSubscriptionWriterUserPrincipalName**: Azure User Principal Name of the user who will create event subscription
55
+
- **$webhookAppObjectId**: Azure AD application ID created for the webhook
56
+
- **$eventSubscriptionWriterUserPrincipalName**: Azure user principal name of the user who will create event subscription
43
57
44
58
> [!NOTE]
45
-
> You don't need to modify the value of **$eventGridAppId**, for this script we set **AzureEventGridSecureWebhookSubscriber** as the value for the **$eventGridRoleName**. Remember, you must be a member of the [Azure AD Application Administrator role](../active-directory/roles/permissions-reference.md#all-roles) or be an owner of the service principal of Webhook app in Azure AD to execute this script.
59
+
> You don't need to modify the value of **$eventGridAppId**. In this script, **AzureEventGridSecureWebhookSubscriber** is set for the **$eventGridRoleName**. Remember, you must be a member of the [Azure AD Application Administrator role](../active-directory/roles/permissions-reference.md#all-roles) or be an owner of the service principal of webhook app in Azure AD to execute this script.
46
60
47
61
If you see the following error message, you need to elevate to the service principal. An additional access check has been introduced as part of create or update of event subscription on March 30, 2021 to address a security vulnerability. The subscriber client's service principal needs to be either an owner or have a role assigned on the destination application service principal.
48
62
@@ -65,22 +79,24 @@ Based on the diagram above, follow the next steps to configure the tenant.
### Configure the event subscription by using Azure AD Application
82
+
### Configure the event subscription by using an Azure AD application
69
83
70
-
1. Create an Azure AD Application forthe Event Grid subscription writer configured to work with the Microsoft directory (Single tenant).
84
+
This section shows how to configure the event subscription by using an Azure AD application.
71
85
72
-
2. Create a secret for the Azure AD Application previously created and save the value (you'll need this value later).
86
+
1. Create an Azure AD application for the Event Grid subscription writer configured to work with the Microsoft directory (Single tenant).
73
87
74
-
3. Go to the Access control (IAM) in the Event Grid Topic and add the role assignment of the Event Grid subscription writer as Event Grid Contributor, this step will allow us to have access to the Event Grid resource when we logged-in into Azure with the Azure AD Application by using the Azure CLI.
88
+
2. Create a secret forthe Azure AD application and save the value (you'll need this value later).
75
89
76
-
4. Create an Azure AD Application for the webhook configured to work with the Microsoft directory (Single tenant).
90
+
3. Go to the **Access control (IAM)** page for the Event Grid topic and assign **Event Grid Contributor** role to the Event Grid subscription writer app. This step will allow you to have access to the Event Grid resource when you logged-in into Azure with the Azure AD application by using Azure CLI.
91
+
92
+
4. Create an Azure AD application for the webhook configured to work with the Microsoft directory (Single tenant).
77
93
78
94
5. Open the [Azure Shell](https://portal.azure.com/#cloudshell/) in the tenant and select the PowerShell environment.
79
95
80
96
6. Modify the value of **$webhookAadTenantId** to connect to the tenant.
@@ -90,13 +106,13 @@ Based on the diagram above, follow the next steps to configure the tenant.
90
106
7. Open the [following script](scripts/event-grid-powershell-webhook-secure-delivery-azure-ad-app.md) and update the values of **$webhookAppObjectId** and **$eventSubscriptionWriterAppId** with your identifiers, then continue to run the script.
91
107
92
108
- Variables:
93
-
- **$webhookAppObjectId**: Azure AD Application ID created for the webhook
94
-
- **$eventSubscriptionWriterAppId**: Azure AD Application ID for Event Grid subscription writer
109
+
- **$webhookAppObjectId**: Azure AD application ID created for the webhook
110
+
- **$eventSubscriptionWriterAppId**: Azure AD application ID for Event Grid subscription writer app.
95
111
96
112
> [!NOTE]
97
-
> You don't need to modify the value of **```$eventGridAppId```**, forthis script we set **AzureEventGridSecureWebhookSubscriber** as the value for the **```$eventGridRoleName```**. Remember, you must be a member of the [Azure AD Application Administrator role](../active-directory/roles/permissions-reference.md#all-roles) or be an owner of the service principal of Webhook appin Azure AD to execute this script.
113
+
> You don't need to modify the value of **```$eventGridAppId```**. In this script, **AzureEventGridSecureWebhookSubscriber** as setforthe **```$eventGridRoleName```**. Remember, you must be a member of the [Azure AD Application Administrator role](../active-directory/roles/permissions-reference.md#all-roles) or be an owner of the service principal of webhook appin Azure AD to execute this script.
98
114
99
-
8. Login as the Event Grid subscription writer Azure AD Application by running the command.
115
+
8. Log in as the Event Grid subscription writer Azure AD Application by running the command.
@@ -109,16 +125,16 @@ Based on the diagram above, follow the next steps to configure the tenant.
109
125
```
110
126
111
127
> [!NOTE]
112
-
>In this scenario we are using an Event Grid System Topic. See [here](/cli/azure/eventgrid), ifyou want to create a subscription forCustom Topics or Event Grid Domains by using the Azure CLI.
128
+
>This scenario uses a system topic. If you want to create a subscription forcustom topics or domains by using Azure CLI, see [CLI reference](/cli/azure/eventgrid).
113
129
114
-
10. If everything was correctly configured, you can successfully create the webhook subscription in your Event Grid Topic.
130
+
10. If everything was correctly configured, you can successfully create the webhook subscription in your Event Grid topic.
115
131
116
132
> [!NOTE]
117
-
> At this point Event Grid is now passing the Azure AD Bearer token to the webhook client in every message, you'll need to validate the Authorization token in your webhook.
133
+
> At this point, Event Grid is now passing the Azure AD bearer token to the webhook client in every message. You'll need to validate the authorization token in your webhook.
118
134
119
135
## Deliver events to a Webhook in a different Azure AD tenant
120
136
121
-
To secure the connection between your event subscription and your webhook endpoint that are in different Azure AD tenants, you'll need to use an Azure AD application as shown in this section. Currently, it's not possible to secure this connection by using an Azure AD user in the Azure portal.
137
+
To secure the connection between your event subscription and your webhook endpoint that are in different Azure AD tenants, you'll need to use an Azure AD **application** as shown in this section. Currently, it's not possible to secure this connection by using an Azure AD **user** in the Azure portal.
122
138
123
139

124
140
@@ -128,17 +144,17 @@ Based on the diagram above, follow next steps to configure both tenants.
128
144
129
145
Do the following steps in **Tenant A**:
130
146
131
-
1. Create an Azure AD application for the Event Grid subscription writer configured to work with any Azure AD directory (Multitenant).
147
+
1. Create an Azure AD application for the Event Grid subscription writer configured to work with any Azure AD directory (Multi-tenant).
132
148
133
-
2. Create a secret for the Azure AD application previously created in the **Tenant A**, and save the value (you'll need this value later).
149
+
2. Create a secret for the Azure AD application, and save the value (you'll need this value later).
134
150
135
-
3. Navigate to the **Access control (IAM)** page forthe event grid topic. Add Azure AD application of the Event Grid subscription writer to the **Event Grid Contributor** role. This step allows the application to have access to the Event Grid resource when you login into Azure with the Azure AD application by using the Azure CLI.
151
+
3. Navigate to the **Access control (IAM)** page forthe Event Grid topic. Assign the **Event Grid Contributor** role to Azure AD application of the Event Grid subscription writer. This step allows the application to have access to the Event Grid resource when you signin into Azure with the Azure AD application by using Azure CLI.
136
152
137
153
### Tenant B
138
154
139
155
Do the following steps in**Tenant B**:
140
156
141
-
1. Create an Azure AD Application for the webhook configured to work with the Microsoft directory (Single tenant).
157
+
1. Create an Azure AD Application for the webhook configured to work with the Microsoft directory (single tenant).
142
158
5. Open the [Azure Shell](https://portal.azure.com/#cloudshell/), and select the PowerShell environment.
143
159
6. Modify the **$webhookAadTenantId** value to connect to the **Tenant B**.
144
160
- Variables:
@@ -155,7 +171,7 @@ Do the following steps in **Tenant B**:
155
171
- **$eventSubscriptionWriterAppId**: Azure AD application ID for Event Grid subscription writer
156
172
157
173
> [!NOTE]
158
-
> You don't need to modify the value of **```$eventGridAppId```**, for this script we set **AzureEventGridSecureWebhookSubscriber** as the value for the **```$eventGridRoleName```**. Remember, you must be a member of the [Azure AD Application Administrator role](../active-directory/roles/permissions-reference.md#all-roles) or be an owner of the service principal of Webhook app in Azure AD to execute this script.
174
+
> You don't need to modify the value of **```$eventGridAppId```**. In this script, **AzureEventGridSecureWebhookSubscriber** is set for **```$eventGridRoleName```**. Remember, you must be a member of the [Azure AD Application Administrator role](../active-directory/roles/permissions-reference.md#all-roles) or be an owner of the service principal of webhook app in Azure AD to execute this script.
159
175
160
176
If you see the following error message, you need to elevate to the service principal. An additional access check has been introduced as part of create or update of event subscription on March 30, 2021 to address a security vulnerability. The subscriber client's service principal needs to be either an owner or have a role assigned on the destination application service principal.
161
177
@@ -169,7 +185,7 @@ Do the following steps in **Tenant B**:
169
185
170
186
Back in**Tenant A**, do the following steps:
171
187
172
-
1. Open the [Azure Shell](https://portal.azure.com/#cloudshell/), and login as the Event Grid subscription writer Azure AD Application by running the command.
188
+
1. Open the [Azure Shell](https://portal.azure.com/#cloudshell/), and sign in as the Event Grid subscription writer Azure AD Application by running the command.
@@ -182,7 +198,7 @@ Back in **Tenant A**, do the following steps:
182
198
183
199
> [!NOTE]
184
200
> In this scenario we are using an Event Grid System Topic. See [here](/cli/azure/eventgrid), if you want to create a subscription for custom topics or Event Grid domains by using the Azure CLI.
185
-
3. If everything was correctly configured, you can successfully create the webhook subscription in your event grid topic.
201
+
3. If everything was correctly configured, you can successfully create the webhook subscription in your Event Grid topic.
186
202
187
203
> [!NOTE]
188
204
> At this point, Event Grid is now passing the Azure AD Bearer token to the webhook client in every message. You'll need to validate the Authorization token in your webhook.
0 commit comments