1

I have an Azure Event Grid subscription, which is returned when I run the following code:-

az eventgrid event-subscription list --resource-group [my resource group]

This returns a list of the event subscriptions that I have. The id is displayed as:

/subscriptions/[subscription ID]/resourceGroups/[my resource group]/providers/Microsoft.Storage/storageAccounts/[my storage account]/providers/Microsoft.EventGrid/eventSubscriptions/[my sub]

And topic as :-

/subscriptions/[susbcription id]/resourceGroups/[my resource group]/providers/Microsoft.Storage/storageAccounts/[my storage account]

However, when I try and use show or update on the event subscription listed, I receive the following error:-

Invalid event subscription request: Supplied URL is invalid. It cannot be null or empty and should be a proper HTTPS URL like https://www.example.com.

I am passing in the topic as listed above into the --source-resource-id parameter as follows:-

az eventgrid event-subscription show --source-resource-id "/subscriptions/[subscription id]/resourceGroups/[my resource group]/providers/microsoft.storage/storageaccounts/[my storage account]" --name [my event subscription]

This appears to follow the syntax in the help file, and the documentation:-

https://learn.microsoft.com/en-us/cli/azure/eventgrid/event-subscription?view=azure-cli-latest#az-eventgrid-event-subscription-show

Any idea what I might be doing wrong?

As discussed below, when running list with the source-resource-id, an empty object is returned:-

List with source-resource-id

If running it without the source-resource-id, and a jmespath query, it returns an object:-

List with query

When running with the cloud cli, get this:-

Azure CLI run

Matthew Darwin
  • 325
  • 1
  • 10
  • This works fine on my side. How and where do you run these commands? – Nancy Nov 26 '19 at 08:48
  • Running these on a ubuntu laptop logged in to the azure subscription. However, I've just noticed my azure-cli is a couple of version out of date, so going to update and see if that resolves the issue. – Matthew Darwin Nov 26 '19 at 10:05
  • Updated to version 2.0.77 of the azure-cli, still receive the same error unfortunately. – Matthew Darwin Nov 26 '19 at 10:11
  • Could you run `az eventgrid event-subscription list --resource-group --source-resource-id "/subscriptions/xxx/resourceGroups/yourRG/providers/Microsoft.Storage/storageAccounts/yourStorageAccount"`? then try` az eventgrid event-subscription show ---` again? – Nancy Nov 26 '19 at 10:15
  • Yes, that returns an empty object, which is a little odd. Without the the source-resource-id it returns the two event subcriptions I have; I'm using the source-resource-id from the topic property from this. – Matthew Darwin Nov 26 '19 at 10:18
  • can you view if you have an event subscription in the specific storage account--events--Event Subscriptions in the Azure portal? – Nancy Nov 26 '19 at 10:24
  • Yes it appears there (and also is working; my function app is firing when I add files to the blob stroage). I've added the output of the list commands above (redacted). – Matthew Darwin Nov 26 '19 at 10:31
  • Could you try to run the same command in the [Azure cloud shell](https://learn.microsoft.com/en-us/azure/cloud-shell/overview)? Is it the same? – Nancy Nov 26 '19 at 10:34
  • Hmm, get exactly the same error; add the image to the main post above. – Matthew Darwin Nov 26 '19 at 11:04

1 Answers1

0

I know I am late but still faced same Issue, So adding solution for reference. Add endpoint property to az eventgerid command. Reason: If Endpoint on Event subscription is of webhook type and we are trying to use update with options like "--included-event-types", then "--endpoint" becomes necessary. Example: az eventgrid event-subscription update --name {eventsubscriptionname} --source-"{source-id}" --included-event-types {eventlist} --endpoint {httpurl}