Azure CLI ile Event Grid özel konusu oluşturma

Bu betik bir Event Grid özel konusu oluşturur.

Bu örneği çalıştırmak için, Azure CLI'nin en son sürümünü yükler. Başlangıç olarak, Azure ile bağlantı oluşturmak için az login komutunu çalıştırın.

Azure CLı için örnekler, Shell için yazılmıştır bash . Bu örneği Windows PowerShell veya komut Isteminde çalıştırmak için betiğin öğelerini değiştirmeniz gerekebilir.

Azure aboneliğiniz yoksa başlamadan önce ücretsiz bir hesap oluşturun.

Örnek betik

#!/bin/bash

# Give your custom topic a unique name
myTopic=demoContosoTopic

# Provice name for resource group
myResourceGroup=demoResourceGroup

# Select the Azure subscription to contain the custom topic.
az account set --subscription "<name or ID of the subscription>"

# Create resource group
az group create --name $myResourceGroup --location westus2

# Create custom topic
az eventgrid topic create --resource-group $myResourceGroup --name $myTopic --location westus2

# Retrieve endpoint and key to use when publishing to the topic
endpoint=$(az eventgrid topic show --name $myTopic -g $myResourceGroup --query "endpoint" --output tsv)
key=$(az eventgrid topic key list --name $myTopic -g $myResourceGroup --query "key1" --output tsv)

echo $endpoint
echo $key

Betik açıklaması

Bu betik, özel konuyu oluşturmak için aşağıdaki komutu kullanır. Tablodaki her komut, komuta özgü belgelere yönlendirir.

Komut Notlar
az eventgrid topic create Event Grid özel konusu oluşturun.

Sonraki adımlar