Skip to content

Commit d6c8cdb

Browse files
authored
Merge pull request #306359 from bachuv/vabachu/durable-event-grid-mi
Add Durable Functions managed identity config instructions for event grid publishing
2 parents 8ff029f + 530eeaf commit d6c8cdb

11 files changed

Lines changed: 91 additions & 3 deletions

articles/azure-functions/durable/durable-functions-event-publishing.md

Lines changed: 91 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Durable Functions publishing to Azure Event Grid
33
description: Learn how to configure automatic Azure Event Grid publishing for Durable Functions.
4-
ms.topic: conceptual
4+
ms.topic: article
55
ms.date: 05/11/2020
66
ms.devlang: csharp
77
# ms.devlang: csharp, javascript
@@ -54,15 +54,15 @@ Get the endpoint of the topic. Replace `<topic_name>` with the name you chose.
5454
az eventgrid topic show --name <topic_name> -g eventResourceGroup --query "endpoint" --output tsv
5555
```
5656

57-
Get the topic key. Replace `<topic_name>` with the name you chose.
57+
Get the topic key if you're using key based authentication. Replace `<topic_name>` with the name you chose.
5858

5959
```azurecli
6060
az eventgrid topic key list --name <topic_name> -g eventResourceGroup --query "key1" --output tsv
6161
```
6262

6363
Now you can send events to the topic.
6464

65-
## Configure Event Grid publishing
65+
## Configure Event Grid publishing with key based authentication
6666

6767
In your Durable Functions project, find the `host.json` file.
6868

@@ -117,6 +117,94 @@ If you're using the [Storage Emulator](../../storage/common/storage-use-emulator
117117

118118
If you're using a real Azure Storage account, replace `UseDevelopmentStorage=true` in `local.settings.json` with its connection string.
119119

120+
## Configure Event Grid publishing with Managed Identity
121+
122+
Managed identities in Azure allow resources to authenticate to Azure services without storing credentials, simplifying security and identity management. _System-assigned_ managed identity is automatically created when you enable it on an Azure resource and is tied to that resource’s lifecycle. If the resource is deleted, the identity is also removed. _User-assigned_ managed identity is created as a standalone Azure resource and can be assigned to multiple resources. It persists independently of any resource, offering flexibility for shared access and centralized identity management. It's recommended that you use user-assigned identity because it's not attached to the lifecycle of the app.
123+
124+
For more information, visit [Use managed identities for App Service and Azure Functions](../../app-service/overview-managed-identity.md).
125+
126+
### System Assigned Identity
127+
To configure system assigned identity follow the instructions below:
128+
129+
#### Configuration
130+
1. Turn on system assigned identity for the function app
131+
- Go to the function app's **Identity** section and in the **System Assigned** tab, toggle the **Status** switch to on.
132+
133+
:::image type="content" source="./media/durable-functions-event-publishing/enable-system-assigned-identity.png" alt-text="Screenshot of enabling system assigned identity in the function app." border="true":::
134+
135+
2. In the Event Grid topic resource, give the function app the EventGrid Data Sender role.
136+
- Go to the **Access Control (IAM)** section, click **+ Add**.
137+
138+
:::image type="content" source="./media/durable-functions-event-publishing/add-role.png" alt-text="Screenshot of adding a role to event grid topic resource." border="true":::
139+
140+
- Select the **EventGrid Data Sender** role, click **Next**.
141+
142+
:::image type="content" source="./media/durable-functions-event-publishing/event-grid-data-sender.png" alt-text="Screenshot of selecting the EventGrid Data Sender Role." border="true":::
143+
144+
- Choose **Managed Identity** in the **Assign access to** section, click **+ Select Members** in the **Members** section, select the managed identity, then click **Review + Assign**.
145+
146+
:::image type="content" source="./media/durable-functions-event-publishing/select-managed-identity.png" alt-text="Screenshot of selecting a managed identity." border="true":::
147+
148+
149+
#### App Settings
150+
Add an `EventGrid__topicEndpoint` app setting with the value as the Event Grid topic endpoint.
151+
152+
You can use the following command:
153+
`az functionapp config appsettings set --name <function app name> --resource-group <resource group name> --settings EventGrid__topicEndpoint="<topic endpoint>"`
154+
155+
### User Assigned Identity
156+
To configure user assigned managed identity follow the instructions below:
157+
158+
#### Configuration
159+
1. Create a user assigned managed identity.
160+
- In the Azure portal, search for _Managed Identities_ in the global search bar.
161+
162+
- Create a user assigned managed identity (UAMI) and select **Review + create**.
163+
164+
:::image type="content" source="./media/durable-functions-event-publishing/create-user-assigned-managed-identity.png" alt-text="Screenshot of creating user assigned managed identity." border="true":::
165+
166+
2. Attach the UAMI to the function app resource
167+
- Go to the function app, **Identity** section, click **Add +**.
168+
169+
:::image type="content" source="./media/durable-functions-event-publishing/function-app-add-user-assigned-managed-identity.png" alt-text="Screenshot of the function app identity section for user assigned managed identity." border="true":::
170+
171+
- Choose the UAMI created above, then click **Add**.
172+
173+
:::image type="content" source="./media/durable-functions-event-publishing/function-app-add-specific-user-assigned-managed-identity.png" alt-text="Screenshot of selecting specific user assigned managed identity." border="true":::
174+
175+
3. Attach the UAMI to the event grid topic resource.
176+
- Go to the event grid topic resource, **Identity** section, choose the **User assigned** tab, then click **Add +**. Choose the user assigned managed identity, then click **Add**.
177+
178+
:::image type="content" source="./media/durable-functions-event-publishing/add-user-assigned-managed-identity-to-event-grid-topic.png" alt-text="Screenshot of adding a user assigned managed identity to event grid topic." border="true":::
179+
180+
4. Create an Event Grid subscription and select an endpoint.
181+
- In the **Overview** tab of the Event Grid Topic resource, select **+ Event Subscription**, and create the event subscription.
182+
183+
:::image type="content" source="./media/durable-functions-event-publishing/event-subscription.png" alt-text="Screenshot of the + Event Subscription button." border="true":::
184+
185+
- Based on the endpoint you choose in **Endpoint Details**, you will see a **Managed Identity for Delivery** section. Choose **User Assigned** for the **Managed Identity** type and select the UAMI.
186+
187+
:::image type="content" source="./media/durable-functions-event-publishing/event-subscription-managed-identity.png" alt-text="Screenshot of adding a user assigned managed identity to event grid subscription." border="true":::
188+
189+
6. In the Event Grid topic resource, assign the **EventGrid Data Sender** role to the UAMI.
190+
191+
- Go to the **Access Control (IAM)** section, click **+ Add**.
192+
193+
:::image type="content" source="./media/durable-functions-event-publishing/add-role.png" alt-text="Screenshot of adding a role to an event grid topic resource." border="true":::
194+
195+
- Select the **EventGrid Data Sender** role, click **Next**.
196+
197+
:::image type="content" source="./media/durable-functions-event-publishing/event-grid-data-sender.png" alt-text="Screenshot of selecting the EventGrid Data Sender Role." border="true":::
198+
199+
- Choose **Managed Identity** in the **Assign access to** section, click **+ Select Members** in the **Members** section, select the UAMI, then click **Review + Assign**.
200+
201+
:::image type="content" source="./media/durable-functions-event-publishing/select-managed-identity.png" alt-text="Screenshot of selecting a managed identity." border="true":::
202+
203+
#### App Settings
204+
- Add an `EventGrid__topicEndpoint` app setting with the value as the Event Grid topic endpoint.
205+
- Add an `EventGrid__credential` app setting with the value `managedidentity`.
206+
- Add an `EventGrid__clientId` app setting with the value of the user assigned managed identity client ID.
207+
120208
## Create functions that listen for events
121209

122210
Using the Azure portal, create another function app to listen for events published by your Durable Functions app. It's best to locate it in the same region as the Event Grid topic.
48.8 KB
Loading
Loading
40 KB
Loading
83.7 KB
Loading
38.3 KB
Loading
60.4 KB
Loading
8.33 KB
Loading
Loading
36.8 KB
Loading

0 commit comments

Comments
 (0)