Engin
Engin

Reputation: 414

Unable to create Webhook Subscription for Event-Grid

I'm having this issue with Azure Event-Grid since yesterday and cannot find where I'm doing wrong.

I've used the below link to create a custom event-grid topic in azure cli. https://learn.microsoft.com/en-us/azure/event-grid/scripts/event-grid-cli-create-custom-topic

And used the link below to handle validation at the endpoint side. https://learn.microsoft.com/en-us/azure/event-grid/receive-events

and testing with the following payload

[{
"subject": "Contoso/foo/bar/items",
"eventType": "Microsoft.EventGrid.SubscriptionValidationEvent",
"eventTime": "2017-08-16T01:57:26.005121Z",
"id": "602a88ef-0001-00e6-1233-1646070610ea",
"data": { 
        "validationCode": "123456789"
        },
"dataVersion": "",
"metadataVersion": "1"
}]

and getting 123456789 back with a 200 response.

When I run the commands at the link below, I'm getting this error.

Deployment failed. Correlation ID: 6acbe8ab-1bf5-4f35-b133-9c907c2e2545. The operation failed due to an internal server error. The initial state of the impacted resources (if any) are restored. Please try again in few minutes. If error still persists, report 05a94a7a-b132-451b-90ff-ceb2f5d587ae:6/3/2020 3:49:40 PM (UTC) to our forums for assistance or raise a support ticket .

https://learn.microsoft.com/en-us/azure/event-grid/scripts/event-grid-cli-subscribe-custom-topic

Much thanks in advance

Upvotes: 1

Views: 591

Answers (1)

Sam Vanhoutte
Sam Vanhoutte

Reputation: 3451

I am missing the implementation of your validation handshake (in your webhook implementation), but if you have just returned the "123456789" in your HTTP-200 response, that might be the reason.

You have to return a json payload, containing your code, like the following:

{
  "validationResponse": "123456789"
}

More detailed explanation in the docs.

Upvotes: 1

Related Questions