Question

Difficulty: MediumImplement Azure Event Grid Solutions

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?

  1. A
    Configure the event subscription to use a user-assigned managed identity to authenticate the endpoint and bypass the handshake validation.
  2. B
    Generate a Shared Access Signature (SAS) token with write permissions for the webhook endpoint and configure it in the Event Grid delivery properties.
  3. Return a JSON response containing a validationResponse property set to the validation code.Answer
  4. D
    Return 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

1
Deserialize the incoming JSON request into an Event Grid event array.
Identify the subscription validation event, which contains the validationCode.
The validation code sent by Event Grid is required to prove ownership of the endpoint.
2
Format the response as a JSON object with the property validationResponse.
A payload structured as {"validationResponse": "<validationCode>"}.
Event Grid requires this specific JSON schema to successfully verify the handshake.
3
Return the formatted JSON payload with an HTTP 200 OK status code.
The subscription deployment completes successfully.
The synchronous validation handshake protocol is satisfied.

Key Concept

Webhook validation handshake in Azure Event Grid
Rate this question