Azure / azure-cli

Azure Command-Line Interface
MIT License
3.98k stars 2.96k forks source link

Event Grid sys topic subscription #21006

Open hichamveo opened 2 years ago

hichamveo commented 2 years ago

I'm trying to create with az cli an Event grid system topic subscription but it fails with the foloowing error:

"statusMessage": "{\"status\":\"Failed\",\"error\":{\"code\":\"ResourceOperationFailure\", \"message\":\"The resource operation completed with terminal provisioning state 'Failed'.\",\"details\":[{\"code\":\"Url validation\", \"message\":\"Webhook validation handshake failed for https://mylogicapp.azurewebsites.net/runtime/webhooks/workflow/scaleUnits/prod-00/workflows/84aa5895b4324710853436be49fed029/triggers/When_a_resource_event_occurs/paths/invoke. Http POST request failed with response code Unknown. For troublehooting, visit https://aka.ms/esvalidation. Activity id:9d3516d8-75ee-4923-bf54-a19f15631fbf, timestamp: 1/16/2022 8:56:35 PM (UTC).\"}]}}",

`Connect-AzAccount $subscription = 'subid' $ResourceGroupName = 'myrg' Set-AzContext -Subscription $subscription

az eventgrid system-topic event-subscription create --name 'testsub' -g $ResourceGroupName --system-topic-name my-systopic --included-event-types Microsoft.Storage.BlobCreated --subject-begins-with '/blobServices/default/containers/mycontainer/blobs' --enable-advanced-filtering-on-arrays true --endpoint "https://mylogicapp.azurewebsites.net/runtime/webhooks/workflow/scaleUnits/prod-00/workflows/84aa5895b4324710853436be49fed029/triggers/When_a_resource_event_occurs/paths/invoke?api-version=2018-11-01&code=myWorkflowcode&sp=%2Ftriggers%2FWhen_a_resource_event_occurs%2Frun&sv=1.0&sig=mysigvalue"

but when I create the subscription manualy via Azure portal it works fine. I suspects the validation handshake via powershell is not taken care of url queries and stops at "Invoke"

For minformation my workflow test has a logic to validate the handshake to retun validation code.

any help please?

ghost commented 2 years ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @jfggdl.

Issue Details
I'm trying to create with az cli an Event grid system topic subscription but it fails with the foloowing error: "statusMessage": "{\"status\":\"Failed\",\"error\":{\"code\":\"ResourceOperationFailure\", \"message\":\"The resource operation completed with terminal provisioning state 'Failed'.\",\"details\":[{\"code\":\"Url validation\", \"message\":\"Webhook validation handshake failed for https://mylogicapp.azurewebsites.net/runtime/webhooks/workflow/scaleUnits/prod-00/workflows/84aa5895b4324710853436be49fed029/triggers/When_a_resource_event_occurs/paths/invoke. Http POST request failed with response code Unknown. For troublehooting, visit https://aka.ms/esvalidation. Activity id:9d3516d8-75ee-4923-bf54-a19f15631fbf, timestamp: 1/16/2022 8:56:35 PM (UTC).\"}]}}", `Connect-AzAccount $subscription = 'subid' $ResourceGroupName = 'myrg' Set-AzContext -Subscription $subscription az eventgrid system-topic event-subscription create --name 'testsub' ` -g $ResourceGroupName --system-topic-name my-systopic ` --included-event-types Microsoft.Storage.BlobCreated ` --subject-begins-with '/blobServices/default/containers/mycontainer/blobs' ` --enable-advanced-filtering-on-arrays true ` --endpoint "https://mylogicapp.azurewebsites.net/runtime/webhooks/workflow/scaleUnits/prod-00/workflows/84aa5895b4324710853436be49fed029/triggers/When_a_resource_event_occurs/paths/invoke?api-version=2018-11-01&code=myWorkflowcode&sp=%2Ftriggers%2FWhen_a_resource_event_occurs%2Frun&sv=1.0&sig=mysigvalue"` but when I create the subscription manualy via Azure portal it works fine. I suspects the validation handshake via powershell is not taken care of url queries and stops at "Invoke" For minformation my workflow test has a logic to validate the handshake to retun validation code. any help please?
Author: hichamveo
Assignees: -
Labels: `Service Attention`, `Event Grid`, `customer-reported`
Milestone: -
yonzhan commented 2 years ago

route to service team

hichamveo commented 2 years ago

for information, the creation works fine using the rest API :

https://docs.microsoft.com/en-us/rest/api/eventgrid/version2021-06-01-preview/system-topic-event-subscriptions/create-or-update#webhookeventsubscriptiondestination

the endpoint url is regestered with url queries

navba-MSFT commented 2 years ago

@hichamveo Apologies for the late reply. For webhook endpoint type, this should be the corresponding webhook URL. I am sending the below sample command which has the example of the webhook URL:

az eventgrid system-topic event-subscription create --name NewFileCallRunbook -g EventGrid --system-topic-name NewFileAtStrg --endpoint-type webhook --endpoint https://e53cc45XXXXXXX777bdb5e.webhook.we.azure-automation.net/webhooks?token=N4hV1C0XXXXXXXXXXXX11gs%3d --subject-begins-with /blobServices/default/containers/cont1/blobs/folder1/ --subject-ends-with .txt --subject-case-sensitive false --included-event-types Microsoft.Storage.BlobCreated

Please change your --endpoint to the webhook url in your command and run the command again. Awaiting your reply.

ghost commented 2 years ago

Hi, we're sending this friendly reminder because we haven't heard back from you in a while. We need more information about this issue to help address it. Please be sure to give us your input within the next 7 days. If we don't hear back from you within 14 days of this comment the issue will be automatically closed. Thank you!

ghost commented 2 years ago

Hi, we're sending this friendly reminder because we haven't heard back from you in a while. We need more information about this issue to help address it. Please be sure to give us your input within the next 7 days. If we don't hear back from you within 14 days of this comment the issue will be automatically closed. Thank you!

hichamveo commented 2 years ago

Hi @navba-MSFT I used the url webhook of a LogicApps standard workflow. So your example is too different of the one provided in this issue. Can you try with a LogicApps url?