Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Provisioning EventGrid Subscription and LogicApp Handler Using Azure CLI
logicAppResourceId=$(az logic workflow show \
-g <resource_group_name> \
-n <logic_app_name> \
--query "id" -o tsv)
logicAppEndpoint=$(az rest \
-m POST \
-u "https://management.azure.com$logicAppResourceId/triggers/manual/listCallbackUrl?api-version=2016-06-01" \
--query "value" -o tsv)
eventGridTopicId=$(az eventgrid topic show \
-g <resource_group_name> \
-n <eventgrid_topic_name> \
--query "id" -o tsv)
az eventgrid event-subscription create \
-n <eventgrid_subscription_name> \
--source-resource-id $eventGridTopicId \
--event-delivery-schema cloudeventschemav1_0 \
--endpoint-type webhook \
--endpoint $logicAppEndpoint
az eventgrid event-subscription create \
-n <eventgrid_subscription_name> \
--source-resource-id $(az eventgrid topic show \
-g <resource_group_name> \
-n <eventgrid_topic_name> \
--query "id" -o tsv) \
--event-delivery-schema cloudeventschemav1_0 \
--endpoint-type webhook \
--endpoint $(az rest \
-m POST \
-u "https://management.azure.com$(az logic workflow show \
-g <resource_group_name> \
-n <logic_app_name> \
--query "id" -o tsv)/triggers/manual/listCallbackUrl?api-version=2016-06-01" \
--query "value" -o tsv)
resource evtgrdtopic 'Microsoft.EventGrid/topics@2020-06-01' = {
name: 'my-eventgrid-topic'
}
resource evtgrdsub 'Microsoft.EventGrid/eventSubscriptions@2020-06-01' = {
name: 'my-eventgrid-sub'
scope: evtgrdtopic
...
}
resource evtgrdtopic 'Microsoft.EventGrid/topics@2020-06-01' = {
name: 'my-eventgrid-topic'
...
}
resource evtgrdsub 'Microsoft.EventGrid/topics/providers/eventSubscriptions@2020-06-01' = {
name: '${evtgrdtopic.name}/Microsoft.EventGrid/my-eventgrid-sub'
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment