You are implementing an ASP.NET Core Web API controller that serves as a Webhook endpoint for an Azure Event Grid subscription. During the creation of the event subscription, the deployment fails with a validation handshake error. You verify that the controller receives the validation request, returns an HTTP 200 OK status code, and includes the validation code as a plain text string in the response body. Which action must you take to resolve the validation handshake failure?
- AConfigure the event subscription to use a user-assigned managed identity to authenticate the endpoint and bypass the handshake validation.
- BGenerate a Shared Access Signature (SAS) token with write permissions for the webhook endpoint and configure it in the Event Grid delivery properties.
- Return a JSON response containing a validationResponse property set to the validation code.Answer
- DReturn an empty HTTP 200 OK response and wait for Azure Event Grid to perform an asynchronous HTTP GET request to the endpoint.
Answer
Return a JSON response containing a validationResponse property set to the validation code.
For Event Grid to complete a synchronous validation handshake, the endpoint must return an HTTP 200 OK status code with a JSON response body containing the validationResponse property set to the validationCode received in the request. Returning the validation code as a plain text string or an empty response body results in a validation failure.
Step-by-Step Solution
Key Concept
Webhook validation handshake in Azure Event Grid