Visualizing Azure Automation job information in Microsoft OMS
Do you use Azure Automation and want to know what jobs have run and their results? Would it be even more useful to have this available on your mobile? If so, check this out!
Microsoft has provided a way to route Azure Automation job information into Microsoft OMS which is available at this article: Forward job status and job streams from Automation to Log Analytics (OMS). This article will discuss a couple of issues that I ran into when I was using this article to forward Azure Automation job information to OMS and will provide information on a pre-built solution to visualize this information in Microsoft OMS.
Forwarding job status and job stream information challenges:
Challenge #1: Using the correct subscription
My accounts are associated with multiple Azure subscriptions and the script seems to assume that you want to work with your default subscription. To find the appropriate subscription use:
This provides a list of subscriptions including the subscription ID’s. Copy the subscription ID for the subscription which contains the Automation Account and the workspace (and replace it where <SUBSCRIPTION GUID> appears below).
To find the correct ResourceId information I had to slightly change their code to add the command to “Login-AzureRmAccount”, and “SelectAzureRmSubscription” command as shown below.
# Find the ResourceId for the Automation Account
# Find the ResourceId for the Log Analytics workspace
To handle this I slightly changed their code to add the “SelectAzureRmSubscription” command as shown below.
# if you are not connected to Azure run the next command to login
# if you have one Log Analytics workspace you can use the following command to get the resource id of the workspace
Challenge #2: Finding the correct ResourceId information
One of the first things that you need to do is to find the ResourceId for the Automation Account and for the Log Analytics Workspace. Both of these were in a format like the following:
Provide a pre-built solution to visualize Azure Automation job information:
When this is in place you can use queries like the ones that they provide to see what jobs have been run in Azure Automation. An example query that they provide in the article is:
AzureDiagnostics | where ResourceProvider == “MICROSOFT.AUTOMATION”
Once the query above has information you should now be able to utilize the pre-built OMS solution which is available for download at: https://gallery.technet.microsoft.com/Azure-Automation-Job-7f5649eb
The top level view provides a list of recent Azure Automation jobs which have been run.
Drilling into this provides recent Azure Automation job executions (including trends of how many jobs are running per hour), what results have been sent back and what job stream information is available. (Yes, I know that I have a typo on the StockPrice one, but it’s working and I didn’t want to delay this blog post J ).
The download for this solution is available at: https://gallery.technet.microsoft.com/Azure-Automation-Job-7f5649eb
Summary: If you use Microsoft’s article to get the data from Azure Automation jobs into OMS and download the visualization for this. Now you have a quick way to see what Azure Automation is up to in your OMS workspace!