You are developing a solution that uses Azure Event Grid to handle custom application events. You need to create a new custom topic, configure a subscription to route events to an Azure Function, and then publish a test event to verify the endpoint routing using an API client.
Which five actions should you perform in sequence? To answer, arrange the actions in the correct order.
- 1Create the custom Event Grid topic.
- 2Retrieve the endpoint URL and access key for the custom topic.
- 3Create the event subscription that routes events to the Azure Function.
- 4Construct a JSON array containing a valid Event Grid event object.
- 5Send an HTTP POST request containing the JSON array to the custom topic endpoint with the access key in the headers.
Answer
Create the custom Event Grid topic, retrieve the endpoint URL and access key, create the event subscription, construct the JSON array with the event object, and send the HTTP POST request to the custom topic endpoint with the access key in the headers.
To configure and verify Event Grid routing, you must follow a logical sequence: first, create the target resource (the custom topic). Once created, retrieve the endpoint URI and SAS key for authorization. Then, create the event subscription so that when you publish the test event, it will actually be routed to the Azure Function rather than being dropped. Next, format the event payload as a JSON array to comply with the Event Grid schema. Finally, send an HTTP POST request to the endpoint, specifying the SAS key in the headers and the JSON array in the request body.
Step-by-Step Solution
Key Concept
Publishing events to a custom Event Grid topic