In this, we’ll learn to subscribe to the blob storage using the web hook in Azure Event Grid. This article is a part of the Azure Event Series focused on Routing Storage Events. We’ll follow up on the previous articles and focus upon event subscription in this article.
Azure Event Grid
Azure Event Grid makes it possible to send the event data from a particular source to handlers. Basically, the Azure Event Grid helps to connect application to numerous other services. As the name says, the Azure Event Grid is a feature enabled by Azure which makes it possible for event-based architecture while building applications. Through the Azure Event Grid, all the incoming events such as resource groups and blob storage are supported. Furthermore, with the custom topics developer’s own events too are supported by the Azure Event Grid. Simply select the Azure Resource to subscribe to and all then we require to do is connect Webhook endpoint or the event handler to the event. Filters can be accessed in order to route certain events to various endpoints, multicast to the multiple endpoints making sure all the events are properly delivered.
Pre-requisites
- Read the article, Azure Event Grid and follow up the process to enable the event grid resource provider.
- Follow the article, Azure Storage Account and create an Azure Storage Account.
- Create message endpoint following the Routing Blob Storage Events Using Azure Event Grid tutorial.
Now, let us learn to subscribe to events using Web Hook in this article.
Step 1
Visit the Storage account you created following the Azure Storage Account article. Click on Events on the left-hand side Menu.
Step 2
Now, on the middle of the page, there is a three-dot button “...”. Click it and Select More Options.
Step 3
Now, we are provided with all the options. Here, select the Web Hook option.
Step 4
Now, we are taken to Event Subscription page.
Name your event subscription detail and select the Event Schema as Event Grid Schema.
Step 5
Under the topic details, name your system topic name.
Now, for the endpoint type, Select Web Hook.
Now, under endpoint, click on Select an endpoint button.
Now, visit the webapp you created on the article, Routing Blob Storage Events Using Azure Event Grid and copy the URL.
Paste it under the Subscriber Endpoint and add /api/updates to the end of the URL.
Once done, click on Confirm Selection.
Step 6
As all details are filled and selected, click on Create.
The creation process will initiate.
As deployment is complete, we’ll be notified.
Step 7
We can visit the Event under the Storage account and we can see the endpoint has been added under event subscription.
Click on it.
We'll be taken to the page where all the metrics and performance are visualized.
Step 8
Now, we can visit our testapp in the browser.
We can see the Event Grid Subscription Validation update is here.
Initially, we can remember it was empty like the following.
Click on the event to extend and view the details.
Thus, with this, we have successfully subscribed to the blob storage event using Web Hook in Azure Event Grid.
Conclusion
Thus, in this article, we went through a step-by-step process to subscribe to blob storage events and pass in the event through Web Hook to our Web App using Azure Event Grid.