I am new to this forum. I have started using Azure Virtual machines in the new portal from http://portal.azure.com.
I am trying to link only specific VMs to trigger automation when a certain criteria is met. E.g. CPU of the VM exceeds a limit then something I want should happen.
I can configure alerts in Azure for this. But all they do is notify someone that the alert is generated. I want one of my automation runbook to execute on this.
Current solution: I have written an automation runbook to read all alerts and take action on specific alerts.
The problem: is that if the alert is generated by one of the unwanted VMs then also the runbook is triggered. I can't hardcode the list of VMs in the Runbook. Is there better solution.
You can achieve this in several ways. One crude way would be to use Webhooks. But the better way is to leverage a new feature in Azure ARM (or newer portal) which you are already using, as your URL mentions. This feature allows the alert created on VM to be directly linked to the Automation Runbook.
Write the Azure Automation Runbook to only expect one VM. Then create an alert on the VM. Then link your alert to the automation Runbook as shown below.
I will also blog on this and will provide the link to my blog soon.