Trigger Azure Function from Azure Monitor alerts

Arun Kamath
3 min readJul 11, 2021

Azure Monitor alerts are a great way of getting notified of any threshold breach of your resource metrics and helps to keep a tab on the health of the Azure resources in a timely manner. Wouldn’t it be great if the follow-up action for the alert is also taken care of !!? Oh yes, keep reading on please…

Azure Monitor alerts gives us the option of triggering an Azure Function as a follow-up action.

For illustration purposes let us consider setting up a ‘Heartbeat’ alert for an Azure Virtual Machine (VM). Heartbeat is a great way to know if your Virtual machine is ‘alive’ , you would have a Heartbeat entry in your Log Analytics workspace every minute or so.


  1. Go to your VM resource and enable ‘Insights’ from the portal to flow through to the Log Analytics workspace
  2. Browse to Azure Monitor → Alerts → +New Alert Rule
  3. Select a specific scope of alert, in this case Log analytics workspace/VM
  4. Search for the “Heartbeat” metric and set the Alert logic as required
Adding an alert based on the Heartbeat metric

5. Create a new action group to trigger the Azure Function app. It is ideal to use a dedicated Service Principal in your Function for authenticating into Azure.



Arun Kamath

Software technology enthusiast with interests in Data & Analytics in Cloud Data applications