Skip to content

Commit e6b097a

Browse files
committed
updated steps and screenshots
1 parent 193a096 commit e6b097a

File tree

4 files changed

+25
-3
lines changed

4 files changed

+25
-3
lines changed

articles/event-grid/custom-event-to-function.md

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,28 @@ Before subscribing to the custom topic, create a function to handle the events.
5050
1. In the **Template details** section in the bottom pane, enter a name for the function. In this example, it's **HandleEventsFunc**.
5151

5252
:::image type="content" source="./media/custom-event-to-function/function-event-grid-trigger.png" lightbox="./media/custom-event-to-function/function-event-grid-trigger.png" alt-text="Select Event Grid trigger.":::
53-
4. On the **Function** page for the **HandleEventsFunc**, select **Code + Test** on the left navigational menu. You can see the existing code for the function and update it on this page.
53+
4. On the **Function** page for the **HandleEventsFunc**, select **Code + Test** on the left navigational menu.
5454

5555
:::image type="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.":::
56+
5. Replace the code with the following code.
5657

58+
```csharp
59+
#r "Azure.Messaging.EventGrid"
60+
#r "System.Memory.Data"
61+
62+
using Azure.Messaging.EventGrid;
63+
using System;
64+
65+
public static void Run(EventGridEvent eventGridEvent, ILogger log)
66+
{
67+
log.LogInformation(eventGridEvent.Data.ToString());
68+
}
69+
```
70+
:::image type="content" source="./media/custom-event-to-function/function-updated-code.png" alt-text="Screenshot showing the Code + Test view of an Azure function with the updated code.":::
71+
6. Select **Monitor** on the left menu, and then select **Logs**.
72+
73+
:::image type="content" source="./media/custom-event-to-function/monitor-page.png" alt-text="Screenshot showing the Monitor view the Azure function.":::
74+
7. Keep this window or tab of the browser open so that you can see the received event information.
5775

5876
## Create a custom topic
5977

@@ -77,7 +95,7 @@ An Event Grid topic provides a user-defined endpoint that you post your events t
7795
1. On the **Review + create** page, review settings and select **Create**.
7896
5. After the custom topic has been created, select **Go to resource** link to see the following Event Grid topic page for the topic you created.
7997

80-
:::image type="content" source="./media/custom-event-to-function/event-grid-topic-home-page.png" alt-text="Image showing the home page for your Event Grid custom topic.":::
98+
:::image type="content" source="./media/custom-event-to-function/event-grid-topic-home-page.png" lightbox="./media/custom-event-to-function/event-grid-topic-home-page.png" alt-text="Image showing the home page for your Event Grid custom topic.":::
8199

82100
## Subscribe to custom topic
83101

@@ -115,10 +133,14 @@ The first example uses Azure CLI. It gets the URL and key for the custom topic,
115133
:::image type="content" source="./media/custom-event-quickstart-portal/cloud-shell-bash.png" alt-text="Image showing Cloud Shell - Bash window":::
116134
1. Set the `topicname` and `resourcegroupname` variables that will be used in the commands.
117135

136+
Replace `TOPICNAME` with the name of your Event Grid topic.
137+
118138
```azurecli
119139
topicname="TOPICNAME"
120140
```
121141

142+
Replace `RESOURCEGROUPNAME` with the name of the Azure resource group that contains the Event Grid topic.
143+
122144
```azurecli
123145
resourcegroupname="RESOURCEGROUPNAME"
124146
```
@@ -196,7 +218,7 @@ The second example uses PowerShell to perform similar steps.
196218
### Verify that function received the event
197219
You've triggered the event, and Event Grid sent the message to the endpoint you configured when subscribing. Navigate to your Event Grid triggered function and open the logs. You should see a copy of the data payload of the event in the logs. If you don't make sure you open the logs window first, or hit reconnect, and then try sending a test event again.
198220

199-
:::image type="content" source="./media/custom-event-to-function/successful-function.png" alt-text="Image showing the Monitor view of the Azure function with a log.":::
221+
:::image type="content" source="./media/custom-event-to-function/successful-function.png" lightbox="./media/custom-event-to-function/successful-function.png" alt-text="Image showing the Monitor view of the Azure function with a log.":::
200222

201223
## Clean up resources
202224
If you plan to continue working with this event, don't clean up the resources created in this article. Otherwise, delete the resources you created in this article.
43.5 KB
Loading
34.4 KB
Loading
-11.8 KB
Loading

0 commit comments

Comments
 (0)