Skip to content

Commit 5d74d45

Browse files
committed
updated
1 parent a487627 commit 5d74d45

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

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

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,15 @@ ms.custom: devx-track-azurecli, mode-api
1717

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

20-
[!INCLUDE [azure-cli-prepare-your-environment.md](../../includes/azure-cli-prepare-your-environment.md)]
21-
2220
## Create a resource group
2321

2422
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.
2523

2624
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.
2725

26+
> [!NOTE]
27+
> Select **Try it** next to the CLI example to launch Cloud Shell in the right pane. Select **Copy** button to copy the command, paste it in the Cloud Shell window, and then press ENTER to run the command.
28+
2829
```azurecli-interactive
2930
az group create --name gridResourceGroup --location westus2
3031
```
@@ -42,9 +43,9 @@ An event grid topic provides a user-defined endpoint that you post your events t
4243
```
4344
1. Run the following command to create the topic.
4445
45-
```azurecli-interactive
46-
az eventgrid topic create --name $topicname -l westus2 -g gridResourceGroup
47-
```
46+
```azurecli-interactive
47+
az eventgrid topic create --name $topicname -l westus2 -g gridResourceGroup
48+
```
4849
4950
## Create Queue storage
5051
@@ -61,7 +62,8 @@ Before subscribing to the custom topic, let's create the endpoint for the event
6162
queuename="eventqueue"
6263
6364
az storage account create -n $storagename -g gridResourceGroup -l westus2 --sku Standard_LRS
64-
az storage queue create --name $queuename --account-name $storagename
65+
key="$(az storage account keys list -n $storagename --query "[0].{value:value}" --output tsv)"
66+
az storage queue create --name $queuename --account-name $storagename --account-key $key
6567
```
6668
6769
## Subscribe to a custom topic
@@ -75,11 +77,11 @@ The following script gets the resource ID of the storage account for the queue.
7577
```azurecli-interactive
7678
storageid=$(az storage account show --name $storagename --resource-group gridResourceGroup --query id --output tsv)
7779
queueid="$storageid/queueservices/default/queues/$queuename"
78-
topicid=$(az eventgrid topic show --name <topic_name> -g gridResourceGroup --query id --output tsv)
80+
topicid=$(az eventgrid topic show --name $topicname -g gridResourceGroup --query id --output tsv)
7981
8082
az eventgrid event-subscription create \
8183
--source-resource-id $topicid \
82-
--name <event_subscription_name> \
84+
--name mystoragequeuesubscription \
8385
--endpoint-type storagequeue \
8486
--endpoint $queueid \
8587
--expiration-date "<yyyy-mm-dd>"
@@ -120,7 +122,7 @@ done
120122

121123
Navigate to the Queue storage in the portal, and notice that Event Grid sent those three events to the queue.
122124

123-
![Show messages](./media/custom-event-to-queue-storage/messages.png)
125+
:::image type="content" source="./media/custom-event-to-queue-storage/messages.png" alt-text="Screenshot showing the list of messages in the queue that are received from Event Grid.":::
124126

125127
> [!NOTE]
126128
> If you use an [Azure Queue storage trigger for Azure Functions](../azure-functions/functions-bindings-storage-queue-trigger.md) for a queue that receives messages from Event Grid, you may see the following error message on the function execution: `The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters.`
14.5 KB
Loading

0 commit comments

Comments
 (0)