Ok I got it now. It was a little bit of a hassle because the metric "Hearbeat" is not available under standard VM metrics (waagent), but only in connection with Log Analytics (omsagent). Connect VM to Log Analytics Workspace where your create a monitoring rule with a condition that monitors the VM's Hearbeat signal. As action, create a PowerShell automation runbook which reboots the VM. Basically it's like @theodorbrander mentioned, only the Log Analytics part was missing.
Failed guest OS does not trigger any action
Matt Schlarb
1
Reputation point
A failing guest OS (eg. kernel panic) does not trigger any action. I know from Hyper-V that you could monitor the guest OS heartbeat and define an action when heartbeat is lost. Is there any possibility in Azure to restart a frozen VM? Other cloud providers will restart the VM when it is not responsive...
2 answers
Sort by: Most helpful
-
Matt Schlarb 6 Reputation points Microsoft Employee
2020-01-10T18:31:28.643+00:00 -
Iwan van de Wetering 1 Reputation point
2019-12-30T15:59:03.63+00:00 Restart-AzureRmVM -ResourceGroupName "ResourceGroup" -Name "VirtualMachine"
From Azure CLI
regardsIwan