In this post I’ll provide a starting point for monitoring Azure with Logic Apps whereby an email is sent when a successful change is made within an Azure subscription.
To start with, check the Event Grid resource provider is registered within your Azure subscription. You can do this in the Azure portal under Subscriptions -> Resource providers.
Next, create a Logic App from the Azure portal, entering a name, resource group and location.
From the splash screen select the common trigger When a Event Grid event occurs.
Click the sign in button to connect to your Azure subscription.
Select your Azure subscription, resource type and resource name. In this example I’ve selected the subscription, for event monitoring across the entire subscription, but you can choose resource group or something else to scope the alerts further. I’ve also added an event type filter for WriteSuccess, but again you can adjust as per your requirements.
In this example I’ve chosen to be notified by email, so click on new step, then select Office 365 Outlook, followed by send an email.
Populate the email body with event information that interests you.
Save the Logic App, then make a change, e.g. resize a VM or create a resource within the subscription to trigger the alert.
If you don’t receive an email check the runs history on the Logic App page.
If nothing is listed check that the Logic app automatically created the Event Grid subscription. Search for Event Grid subscriptions in the Azure portal.
If nothing is listed re-register the EventGrid resource provider in your Subscription. I did this using Azure Cloud Shell Register-Azure RmResource Provider -ProviderNamespace Microsoft.EventGrid.
Once you have the basics working you can customise further, e.g. to only notify for changes related to virtual machines. In a future post I’ll show how to do this.