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/custom-event-to-function.md
+13-10Lines changed: 13 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
title: 'Quickstart: Send custom events to Azure Function - Event Grid'
3
3
description: 'Quickstart: Use Azure Event Grid and Azure CLI or portal to publish a topic, and subscribe to that event. An Azure Function is used for the endpoint.'
4
-
ms.date: 01/04/2024
4
+
ms.date: 04/24/2024
5
5
ms.topic: quickstart
6
6
ms.custom: mode-other, devx-track-azurecli
7
7
ms.devlang: azurecli
@@ -26,6 +26,7 @@ ms.devlang: azurecli
26
26
1. Create a new **resource group** or select an existing resource group.
27
27
1. Specify a **name** for the function app.
28
28
1. Select **.NET** for **Runtime stack**.
29
+
1. For **Version**, select **6 (LTS), in-process model**.
29
30
1. Select the **region** closest to you.
30
31
1. Select **Next: Storage** at the bottom of the page.
31
32
@@ -39,18 +40,20 @@ ms.devlang: azurecli
39
40
## Create a function
40
41
Before subscribing to the custom topic, create a function to handle the events.
41
42
42
-
1. On the **Function App** page, select **Create in Azure portal** link in the right pane.
43
+
1. On the **Function App** page, in the **Create in Azure portal** section, select **Create function** link in the right pane.
43
44
44
-
:::image type="content" source="./media/custom-event-to-function/create-function-link.png" alt-text="Screenshot showing the selection of Create function link.":::
45
-
45
+
:::image type="content" source="./media/custom-event-to-function/create-function-link.png" alt-text="Screenshot showing the selection of Create function link.":::
46
46
1. On the **Create Function** page, follow these steps:
47
47
1. In the **Select a template** section, in the filter or search box, type **Azure Event Grid trigger**.
48
-
1. Select **Azure Event Grid Trigger** template in the template list.
49
-
1. In the **Template details** section in the bottom pane, enter a name for the function. In this example, it's **HandleEventsFunc**.
50
-
1. Select **Create**.
48
+
1. Select **Azure Event Grid Trigger** template in the template list.
4. On the **Function** page for the **HandleEventsFunc**, select **Code + Test** on the left navigational menu, replace the code with the following code, and then select **Save** on the command bar.
52
+
1. On the **Template details** page, enter a name for the function. In this example, it's **HandleEventsFunc**.
1. On the **Function** page for the **HandleEventsFunc**, select **Code + Test** on the left navigational menu, replace the code with the following code, and then select **Save** on the command bar.
54
57
55
58
```csharp
56
59
#r"Azure.Messaging.EventGrid"
@@ -66,7 +69,7 @@ Before subscribing to the custom topic, create a function to handle the events.
66
69
```
67
70
68
71
:::imagetype="content"source="./media/custom-event-to-function/function-code-test-menu.png"alt-text="Image showing the selection Code + Test menu for an Azure function.":::
6. Select**Monitor**ontheleftmenu, andswitch to the **Logs** tab. Keep this window or tab of the browser open so that you can see the received event information.
70
73
71
74
:::image type="content" source="./media/custom-event-to-function/monitor-page.png" alt-text="Screenshot showing the Monitor view the Azure function.":::
72
75
@@ -77,7 +80,7 @@ An Event Grid topic provides a user-defined endpoint that you post your events t
77
80
1. On a new tab of the web browser window, sign in to [Azure portal](https://portal.azure.com/).
:::imagetype="content"source="./media/custom-event-to-function/select-topics.png"alt-text="Image showing the selection of Event Grid topics.":::
83
+
:::imagetype="content"source="./media/custom-event-to-function/select-topics.png"alt-text="Image showing the selection of Event Grid topics."lightbox="./media/custom-event-to-function/select-topics.png":::
:::imagetype="content"source="./media/custom-event-to-function/add-topic-button.png"alt-text="Screenshot showing the Create button to create an Event Grid topic.":::
0 commit comments