Azure Event Grid Monitor Your Azure Subscription With Azure Event Grid and Power BI

Azure subscription is at the core of the majority of cloud offerings in Azure. It gives you great audit logs and configurable Role-based Access Control (RBAC). You can grab the logs using a ‘pull’ approach. But how about a ‘push’ approach? Is it possible? With Azure Event Grid, it is! Read on, and I will show you how to do it in less than 30 minutes.  

Key points
  • What is Azure Event Grid?
  • How to use it for setting up event subscriptions
  • How to visualize data

Let’s start with the basics!

What is Azure Event Grid? 

Azure Event Grid is a cloud-based routing service that offers a pub-sub model. The main concepts of this service are topics and subscriptions, like in most messaging systems.  

The service allows you to ingest events from Azure messaging services (Service Bus, IoT Hub, Event Hub), Resource/Subscription events and Custom events. You can trigger custom events from your system using HTTP calls, which are described here.  

Azure Event Grid is meant for processing events and not messages (you can check the messaging services comparison here). In this article, I’ll cover the topic of Azure Subscription that integrates with Azure Function-based WebHook. 

Azure Event Grid overview

Azure Event Grid overview (Source)

Sample application architecture 

For the purpose of this article, I created a simple Azure Function that saves events received through the Event Grid in Azure Table Storage using function bindings. You can find out more about Azure Functions in my other article. Then, I load the data and display it as a Power BI report. 

Architecture diagram

Sample solution architecture

You can browse the source code of this solution on GitHub. 

To start, we need to create infrastructure in the resource group. To speed things up, I created an ARM template for you. 

Adding a new subscription 

After infrastructure and source code deployment, we need to create a new subscription that collects the Azure Subscription events and forwards them to the specified Azure Function URL. We can do it in multiple ways, i.e. through the Portal or Azure Resource Manager. 


To set up a subscription using the Azure Portal, open it and find Event Grid Subscriptions using the search box to create a new subscription. 

Azure Portal view

Setting up subscription in Portal

Enter the new subscription name and URL of the Azure Function from the previous step responsible for event processing.

Configuration screen

Configuring event subscription

After filling out the required configuration fields, you should see your new subscription. 

Azure Resource Manager 

You can also do this in a more automated way by deploying an Azure Resource Manager (ARM) template. You can check my template here. The only difference is that we need to deploy this at subscription level and not at a resource group level.  

To do that with PowerShell, run the New-AzDeployment command instead of New-AzResourceGroupDeployment.

ARM template for Event Grid subscription

Sample Event Grid subscription in Azure Resource Manager (ARM) template

Event handling 

The function I created parses all input events and saves them as new rows in Azure Table Storage. As you may have noticed, one event is processed in a different way – Microsoft.EventGrid.SubscriptionValidationEvent. This is an HTTP call from Event Grid that validates ownership of the provided WebHook url. In our case it validates the access to Azure Function. 

Function code for event handling

Function code for event handling

Event stream visualization 

All data saved in Azure Table Storage is visualized as a Power BI report. This can help you find insights about a failed deployment and other operations invoked at the subscription and deeper levels. 

A sample Power BI event stream report

Sample Power BI event stream report


Azure Event Grid is a relatively new offering that can help you integrate events from various sources, starting with Azure services and ending with your systems in nearly real-time. This service is quite inexpensive: it only charges you 0.60 USD per million operations, and the first million are free.  

Are you still hungry for knowledge? You can expect more about serverless with the use of Azure Event Grid soon. Get in touch and follow me on LinkedIn to be up to date.

Key takeaways
  1. Azure Event Grid – a service that routes incoming events to subscribers, like an office assistant.
  2. Azure Functions – a serverless service that runs custom code in the cloud. Great as an Event Grid event subscriber.
  3. You can build automation for only a few dollars per month when using Azure Serverless services (Logic Apps, Functions and Event Grid).

Sign up for Predica Newsletter

A weekly, ad-free newsletter that helps cutomer stay in the know. Take a look.

Ready to learn more about us?


Want more updates like this? Join thousands of specialists who already follow our newsletter.