Skip to content

Commit 850a2f0

Browse files
authored
Merge pull request #301682 from TimShererWithAquent/us439357-02
Freshness Edit: Azure Event Grid (2 of 7)
2 parents a48ef2c + d846d68 commit 850a2f0

File tree

2 files changed

+19
-18
lines changed

2 files changed

+19
-18
lines changed

articles/event-grid/custom-event-to-queue-storage.md

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,27 @@
11
---
22
title: 'Quickstart: Send custom events to a queue - Event Grid, Azure CLI'
33
description: Learn how to use Azure Event Grid and the Azure CLI to publish a topic and subscribe to that event, by using a queue for the endpoint.
4-
ms.date: 01/31/2024
4+
ms.date: 06/24/2025
55
ms.topic: quickstart
66
ms.custom: devx-track-azurecli, mode-api
7+
#customer intent: As a developer, I want to use Azure Event Grid to integrate applications by using events.
78
---
89

910
# Quickstart: Route custom events to a queue by using Event Grid and the Azure CLI
1011

11-
[Azure Event Grid](overview.md) is a highly scalable and serverless event broker that you can use to integrate applications via events. Event Grid delivers events to [supported event handlers](event-handlers.md), and Azure Queue storage is one of them.
12-
1312
In this quickstart, you use the Azure CLI to create an Event Grid custom topic and a Queue Storage subscription for that topic. You then send sample events to the custom topic and verify that those events are delivered to a queue.
1413

14+
[Azure Event Grid](overview.md) is a highly scalable and serverless event broker that you can use to integrate applications via events. Event Grid delivers events to supported event handlers, such as Azure Queue storage. For more information, see [Event handlers](event-handlers.md).
15+
1516
[!INCLUDE [quickstarts-free-trial-note.md](~/reusable-content/ce-skilling/azure/includes/quickstarts-free-trial-note.md)]
1617

1718
## Create a resource group
1819

19-
Event Grid topics are Azure resources, and they must be placed in an Azure resource group. The resource group is a logical collection into which Azure resources are deployed and managed.
20+
Event Grid topics are Azure resources. Place them in an Azure resource group. The resource group is a logical collection in which Azure resources are deployed and managed.
2021

2122
Create a resource group by using the [az group create](/cli/azure/group#az-group-create) command. The following example creates a resource group named `gridResourceGroup` in the `westus2` location.
2223

23-
Select **Open Cloud Shell** to open Azure Cloud Shell on the right pane. Select the **Copy** button to copy the command, paste it in Cloud Shell, and then select the Enter key to run the command.
24+
Select **Open Cloud Shell** to open Azure Cloud Shell on the right pane. Select the **Copy** button to copy the command, paste it in Cloud Shell, and then select the **Enter** key to run the command.
2425

2526
```azurecli-interactive
2627
az group create --name gridResourceGroup --location westus2
@@ -43,7 +44,7 @@ Replace `<TOPIC NAME>` with a unique name for your custom topic. The Event Grid
4344
1. Run the following command to create the topic:
4445
4546
```azurecli-interactive
46-
az eventgrid topic create --name $topicname -l westus2 -g gridResourceGroup
47+
az eventgrid topic create --name $topicname --location westus2 --resource-group gridResourceGroup
4748
```
4849
4950
## Create a queue
@@ -61,14 +62,14 @@ Before you subscribe to the custom topic, create the endpoint for the event mess
6162
```azurecli-interactive
6263
queuename="eventqueue"
6364
64-
az storage account create -n $storagename -g gridResourceGroup -l westus2 --sku Standard_LRS
65-
key="$(az storage account keys list -n $storagename --query "[0].{value:value}" --output tsv)"
65+
az storage account create --name $storagename --resource-group gridResourceGroup --location westus2 --sku Standard_LRS
66+
key="$(az storage account keys list --account-name $storagename --query "[0].{value:value}" --output tsv)"
6667
az storage queue create --name $queuename --account-name $storagename --account-key $key
6768
```
6869
6970
## Subscribe to a custom topic
7071
71-
The following example subscribes to the custom topic that you created, and it passes the resource ID of the queue for the endpoint. With the Azure CLI, you pass the queue ID as the endpoint. The endpoint is in this format:
72+
The following example subscribes to the custom topic that you created. It passes the resource ID of the queue for the endpoint. With the Azure CLI, you pass the queue ID as the endpoint. The endpoint is in this format:
7273
7374
`/subscriptions/<AZURE SUBSCRIPTION ID>/resourcegroups/<RESOURCE GROUP NAME>/providers/Microsoft.Storage/storageAccounts/<STORAGE ACCOUNT NAME>/queueservices/default/queues/<QUEUE NAME>`
7475
@@ -79,7 +80,7 @@ Before you run the command, replace the placeholder for the [expiration date](co
7980
```azurecli-interactive
8081
storageid=$(az storage account show --name $storagename --resource-group gridResourceGroup --query id --output tsv)
8182
queueid="$storageid/queueservices/default/queues/$queuename"
82-
topicid=$(az eventgrid topic show --name $topicname -g gridResourceGroup --query id --output tsv)
83+
topicid=$(az eventgrid topic show --name $topicname --resource-group gridResourceGroup --query id --output tsv)
8384
8485
az eventgrid event-subscription create \
8586
--source-resource-id $topicid \
@@ -89,7 +90,7 @@ az eventgrid event-subscription create \
8990
--expiration-date "<yyyy-mm-dd>"
9091
```
9192

92-
The account that creates the event subscription must have write access to the queue. Notice that an expiration date is set for the subscription.
93+
The account that creates the event subscription must have write access to the queue. An expiration date is set for the subscription.
9394

9495
If you use the REST API to create the subscription, you pass the ID of the storage account and the name of the queue as a separate parameter:
9596

@@ -108,11 +109,11 @@ If you use the REST API to create the subscription, you pass the ID of the stora
108109
Trigger an event to see how Event Grid distributes the message to your endpoint. First, get the URL and key for the custom topic:
109110

110111
```azurecli-interactive
111-
endpoint=$(az eventgrid topic show --name $topicname -g gridResourceGroup --query "endpoint" --output tsv)
112-
key=$(az eventgrid topic key list --name $topicname -g gridResourceGroup --query "key1" --output tsv)
112+
endpoint=$(az eventgrid topic show --name $topicname --resource-group gridResourceGroup --query "endpoint" --output tsv)
113+
key=$(az eventgrid topic key list --name $topicname --resource-group gridResourceGroup --query "key1" --output tsv)
113114
```
114115

115-
For the sake of simplicity in this article, you use sample event data to send to the custom topic. Typically, an application or an Azure service would send the event data.
116+
For simplicity, this article uses sample event data to send to the custom topic. Typically, an application or an Azure service would send the event data.
116117

117118
The cURL tool sends HTTP requests. In this article, you use cURL to send the event to the custom topic. The following example sends three events to the Event Grid topic:
118119

@@ -124,13 +125,13 @@ do
124125
done
125126
```
126127

127-
Go to the queue in the Azure portal, and notice that Event Grid sent those three events to the queue.
128+
Go to the queue in the Azure portal to see that Event Grid sent those three events to the queue.
128129

129-
:::image type="content" source="./media/custom-event-to-queue-storage/messages.png" alt-text="Screenshot that shows a list of messages received from Event Grid in a queue.":::
130+
:::image type="content" source="./media/custom-event-to-queue-storage/messages.png" alt-text="Screenshot that shows a list of messages received from Event Grid in a queue." lightbox="./media/custom-event-to-queue-storage/messages.png":::
130131

131132
## Clean up resources
132133

133-
If you plan to continue working with this event, don't clean up the resources that you created in this article. Otherwise, use the following command to delete the resources:
134+
If you plan to continue working with this event, don't remove the resources that you created in this article. Otherwise, use the following command to delete the resources:
134135

135136
```azurecli-interactive
136137
az group delete --name gridResourceGroup
@@ -143,7 +144,7 @@ Now that you know how to create topics and event subscriptions, learn more about
143144
- [About Event Grid](overview.md)
144145
- [Route Azure Blob Storage events to a custom web endpoint](../storage/blobs/storage-blob-event-quickstart.md?toc=%2fazure%2fevent-grid%2ftoc.json)
145146
- [Monitor virtual machine changes with Azure Event Grid and Logic Apps](monitor-virtual-machine-changes-logic-app.md)
146-
- [Stream big data into a data warehouse](event-hubs-integration.md)
147+
- [Migrate Event Hubs captured data from Azure Storage to Azure Synapse Analytics](event-hubs-integration.md)
147148

148149
To learn about publishing events to, and consuming events from, Event Grid by using various programming languages, see the following samples:
149150

-1.54 KB
Loading

0 commit comments

Comments
 (0)