4/8/2024 0 Comments Azure event grid topic typeTypically, an application or Azure service would send the event data. To simplify this article, you use sample event data to send to the custom topic. Key=$(az eventgrid topic key list -name $topicname -g gridResourceGroup -query "key1" -output tsv) endpoint=$(az eventgrid topic show -name $topicname -g gridResourceGroup -query "endpoint" -output tsv) First, let's get the URL and key for the custom topic. Let's trigger an event to see how Event Grid distributes the message to your endpoint. The account that creates the event subscription must have write access to the event hub. Topicid=$(az eventgrid topic show -name $topicname -g gridResourceGroup -query id -output tsv) hubid=$(az eventhubs eventhub show -name $hubname -namespace-name $namespace -resource-group gridResourceGroup -query id -output tsv) It sets the endpoint type to eventhub and uses the event hub ID for the endpoint. The following script gets the resource ID for the event hub, and subscribes to an Event Grid topic. subscriptions//resourceGroups//providers/Microsoft.EventHub/namespaces//eventhubs/ The following example subscribes to the custom topic you created, and passes the resource ID of the event hub for the endpoint. You subscribe to an Event Grid topic to tell Event Grid which events you want to track. hubname=demohubĪz eventhubs namespace create -name $namespace -resource-group gridResourceGroupĪz eventhubs eventhub create -name $hubname -namespace-name $namespace -resource-group gridResourceGroup Run the following commands to create an Event Hubs namespace and an event hub named demohub in that namespace. Specify a unique name for the Event Hubs namespace. You create an event hub for collecting the events. az eventgrid topic create -name $topicname -l westus2 -g gridResourceGroupīefore subscribing to the custom topic, let's create the endpoint for the event message. Run the following command to create the topic. The Event Grid topic name must be unique because it's represented by a DNS entry. Replace with a unique name for your custom topic. The following example creates the custom topic in your resource group. When registrationState is Registered, you're ready to continue.Īn Event Grid topic provides a user-defined endpoint that you post your events to. To check the status, run the following command: az provider show -namespace Microsoft.EventGrid -query "registrationState" It might take a moment for the registration to finish. Run the following command to register the provider: az provider register -namespace Microsoft.EventGrid If you haven't previously used Event Grid in your Azure subscription, you might need to register the Event Grid resource provider. az group create -name gridResourceGroup -location westus2 Select Copy button to copy the command, paste it in the Cloud Shell window, and then press ENTER to run the command. Select Try it next to the CLI example to launch Cloud Shell in the right pane.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |