I am in learning phase of Azure. Recently I was working on setting up alerts to get an email notification when Azure runbook fails. I am testing it on a test runbook which has a simple code to display "Hello" and for deliberately failing the runbook, I am mis-spelling Write-Output command as Write-Output11 just to test the failure. The runbook is created using powershell and I am using try-catch block to catch the error
The runbook is marked as Failed as Write-Output11 is not a valid command
I have setup a simple Alert which will detect this runbook and check for its Failed state
The condition used while setting up alert is
Runbook Name = Test_Runbook
Status = Failed
Alert Logic
Operator = Greater than or equal to
Aggregation Type = Total
Threshold Value = 0
Unit = Count
Aggregation Granularity = 1 min
Frequency of Evaluation = Every 1 min
The runbook fails everytime I execute it(as Write-Output11 is invalid command) but alerts are not triggered to detect the runbook failure.
Please advise what wrong I am setting up?