When monitoring the alerts of my Runbooks jobs ResultType provides wrong values.


In Log Analytics records, ResutlType column shows "Completed" or "In Progress" instead of "Failed" for all Runbooks jobs completed with errors.

3 Replies


I am not sure if this is a statement or question. Azure Automation periodically sends diagnostic logs to Log Analytics. Each runbook job is at some state at different periods. There could be runbooks that run for longer period and because of that Azure Automation will send the jobs of those runbooks as In Progress instead of not sending information for them at all. So for a single job you might have records for both In Progress and both Completed at some point in time. Of course the last record is the last state of the runbook job. Keep in mind that for a single runbook you might have multiple  job instances and they all be in different states depending on their end result. Also if you are familiar with Azure Automaiton runbooks you have to explicit put in your code if errors should result in the runbook failing or just continuing by just logging the errors but the end runbook will be marked completed. The same behavior is for warnings.

More information on Azure Automation diagnostic logs:


More information on runbook error handling here:


best response confirmed by Antoineb (Microsoft)

I have resolved this issue by adding the following PowerShell variable in my code before the cmdlet:

$ErrorActionPreference = 'Stop'


You should have marked my reply as answer as I've pointed you to the documentation where this is described.