Skip to content

Commit 9f06880

Browse files
committed
Event Grid freshness
1 parent dbc2dc2 commit 9f06880

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

articles/event-grid/custom-event-quickstart.md

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: 'Quickstart: Send custom events with Event Grid and Azure CLI'
33
description: 'Quickstart Use Azure Event Grid and Azure CLI to publish a custom topic, and subscribe to events for that topic. The events are handled by a web application.'
4-
ms.date: 10/28/2022
4+
ms.date: 01/05/2024
55
ms.topic: quickstart
66
ms.custom: devx-track-azurecli, mode-api
77
---
@@ -79,15 +79,23 @@ You subscribe to an Event Grid topic to tell Event Grid which events you want to
7979
8080
The endpoint for your web app must include the suffix `/api/updates/`.
8181
82-
```azurecli-interactive
83-
endpoint=https://$sitename.azurewebsites.net/api/updates
82+
1. Copy the following command, replace `$sitename` with the name of the web app you created in the previous step, and press ENTER to run the command.
8483
85-
az eventgrid event-subscription create \
86-
--source-resource-id "/subscriptions/{subscription-id}/resourceGroups/{resource-group}/providers/Microsoft.EventGrid/topics/$topicname" \
87-
--name demoViewerSub \
88-
--endpoint $endpoint
89-
90-
```
84+
```azurecli-interactive
85+
endpoint=https://$sitename.azurewebsites.net/api/updates
86+
```
87+
2. Run the following command to get the resource ID of the topic you created.
88+
89+
```azurecli-interactive
90+
topicresourceid=$(az eventgrid topic show --resource-group gridResourceGroup --name $topicname --query id)
91+
```
92+
1. Run the following command to create a subscription to the custom topic using the endpoint.
93+
```azurecli-interactive
94+
az eventgrid event-subscription create \
95+
--source-resource-id $topicresourceid \
96+
--name demoViewerSub \
97+
--endpoint $endpoint
98+
```
9199
92100
View your web app again, and notice that a subscription validation event has been sent to it. Select the eye icon to expand the event data. Event Grid sends the validation event so the endpoint can verify that it wants to receive event data. The web app includes code to validate the subscription.
93101

0 commit comments

Comments
 (0)