Skip to content

Commit 8f50133

Browse files
authored
Merge pull request #216395 from spelluru/egridcustomqs1028
freshness update
2 parents d1d1279 + 2b425b2 commit 8f50133

File tree

1 file changed

+27
-19
lines changed

1 file changed

+27
-19
lines changed

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

Lines changed: 27 additions & 19 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: 07/01/2021
4+
ms.date: 10/28/2022
55
ms.topic: quickstart
66
ms.custom: devx-track-azurecli, mode-api
77
---
@@ -13,7 +13,7 @@ Typically, you send events to an endpoint that processes the event data and take
1313

1414
When you're finished, you see that the event data has been sent to the web app.
1515

16-
![View results in the Azure Event Grid Viewer](./media/custom-event-quickstart/azure-event-grid-viewer-record-inserted-event.png)
16+
:::image type="content" source="./media/custom-event-quickstart/azure-event-grid-viewer-record-inserted-event.png" alt-text="Screenshot showing the Event Grid Viewer sample with a sample event.":::
1717

1818
[!INCLUDE [quickstarts-free-trial-note.md](../../includes/quickstarts-free-trial-note.md)]
1919

@@ -25,9 +25,7 @@ When you're finished, you see that the event data has been sent to the web app.
2525

2626
Event Grid topics are Azure resources, and must be placed in an Azure resource group. The resource group is a logical collection into which Azure resources are deployed and managed.
2727

28-
Create a resource group with the [az group create](/cli/azure/group#az-group-create) command.
29-
30-
The following example creates a resource group named *gridResourceGroup* in the *westus2* location.
28+
Create a resource group with the [az group create](/cli/azure/group#az-group-create) command. The following example creates a resource group named *gridResourceGroup* in the *westus2* location. If you click **Try it**, you'll see the Azure Cloud Shell window in the right pane. Then, click **Copy** to copy the command and paste it in the Azure Cloud Shell window, and press ENTER to run the command. Change the name of the resource group and the location if you like.
3129

3230
```azurecli-interactive
3331
az group create --name gridResourceGroup --location westus2
@@ -37,28 +35,38 @@ az group create --name gridResourceGroup --location westus2
3735

3836
## Create a custom topic
3937

40-
An event grid topic provides a user-defined endpoint that you post your events to. The following example creates the custom topic in your resource group using Bash in Azure Cloud Shell. Replace `<your-topic-name>` with a unique name for your topic. The custom topic name must be unique because it's part of the DNS entry. Additionally, it must be between 3-50 characters and contain only values a-z, A-Z, 0-9, and "-"
38+
An Event Grid topic provides a user-defined endpoint that you post your events to. The following example creates the custom topic in your resource group using Bash in Azure Cloud Shell. Replace `<your-topic-name>` with a unique name for your topic. The custom topic name must be unique because it's part of the DNS entry. Additionally, it must be between 3-50 characters and contain only values a-z, A-Z, 0-9, and "-"
4139

42-
```azurecli-interactive
43-
topicname=<your-topic-name>
40+
1. Copy the following command, specify a name for the topic, and press ENTER to run the command.
4441

45-
az eventgrid topic create --name $topicname -l westus2 -g gridResourceGroup
46-
```
42+
```azurecli-interactive
43+
topicname=<your-topic-name>
44+
```
45+
2. Use the [`az eventgrid topic create`](/cli/azure/eventgrid/topic#az-eventgrid-topic-create) command to create a custom topic.
46+
47+
```azurecli-interactive
48+
az eventgrid topic create --name $topicname -l westus2 -g gridResourceGroup
49+
```
4750
4851
## Create a message endpoint
4952
5053
Before subscribing to the custom topic, let's create the endpoint for the event message. Typically, the endpoint takes actions based on the event data. To simplify this quickstart, you deploy a [pre-built web app](https://github.com/Azure-Samples/azure-event-grid-viewer) that displays the event messages. The deployed solution includes an App Service plan, an App Service web app, and source code from GitHub.
5154
52-
Replace `<your-site-name>` with a unique name for your web app. The web app name must be unique because it's part of the DNS entry.
5355
54-
```azurecli-interactive
55-
sitename=<your-site-name>
5656
57-
az deployment group create \
58-
--resource-group gridResourceGroup \
59-
--template-uri "https://raw.githubusercontent.com/Azure-Samples/azure-event-grid-viewer/master/azuredeploy.json" \
60-
--parameters siteName=$sitename hostingPlanName=viewerhost
61-
```
57+
1. Copy the following command, specify a name for the web app (Event Grid Viewer sample), and press ENTER to run the command. Replace `<your-site-name>` with a unique name for your web app. The web app name must be unique because it's part of the DNS entry.
58+
59+
```azurecli-interactive
60+
sitename=<your-site-name>
61+
```
62+
2. Run the [`az deployment group create`](/cli/azure/deployment/group#az-deployment-group-create) to deploy the web app using an Azure Resource Manager template.
63+
64+
```azurecli-interactive
65+
az deployment group create \
66+
--resource-group gridResourceGroup \
67+
--template-uri "https://raw.githubusercontent.com/Azure-Samples/azure-event-grid-viewer/master/azuredeploy.json" \
68+
--parameters siteName=$sitename hostingPlanName=viewerhost
69+
```
6270
6371
The deployment may take a few minutes to complete. After the deployment has succeeded, view your web app to make sure it's running. In a web browser, navigate to:
6472
`https://<your-site-name>.azurewebsites.net`
@@ -67,7 +75,7 @@ You should see the site with no messages currently displayed.
6775
6876
## Subscribe to a custom topic
6977
70-
You subscribe to an event grid topic to tell Event Grid which events you want to track and where to send those events. The following example subscribes to the custom topic you created, and passes the URL from your web app as the endpoint for event notification.
78+
You subscribe to an Event Grid topic to tell Event Grid which events you want to track and where to send those events. The following example subscribes to the custom topic you created, and passes the URL from your web app as the endpoint for event notification.
7179
7280
The endpoint for your web app must include the suffix `/api/updates/`.
7381

0 commit comments

Comments
 (0)