Currently I am doing some more OMS stuff and therefore I also took a deeper dive at building ARM templates to deploy an OMS solution. I was looking for a simple Azure service to gather data from, which I could ingest into OMS. My goal was, to have a use case, where I only need to provide the minimal parameters necessary and the rest should be done by the ARM template.
How does it work?
Well, basically there is Azure Automation which runs a PowerShell script on an hourly schedule to collect data from Azure Scheduler service. If there are any collections and jobs in Azure Scheduler it will ingest the data into OMS via API.
The OMS solution will contains the following views:
- Jobs with errors
- Status of the jobs
- Jobs and how many times it has been executed
- How many jobs a collection contains
- Some useful queries
How do I deploy it?
Go to my https://github.com/stefanrothnet/AzureScheduler…
You need to provide the credentials to access Azure Scheduler service, these will be saved in the Azure Automation account. Make sure the credentials have permission to access the subscription you are accessing. In addition you need to provide a schedule link GUID. Because there is no function in ARM template to generate a GUID, we need manually to provide a GUID. This GUID is needed to link the Azure Automation schedule to the Azure Automation runbook. Use PowerShell cmdlet New-Guid to generate a GUID and paste it into to the settings.
The template does the following steps:
- Creates a resource group
- Creates an Azure Automation account
- Deploys the PowerShell runbook / script to collect Azure Scheduler data
- Creates an Azure Automation schedule to run the runbook to collect the data. It starts every one hour starting at deployment.
- Creates an Azure Automation variables for OMS workspace and key
- Creates an Azure Automation variable for the current subscription id
- Creates an Azure Automation credential with username and password
- Updates the AzureRM.Profile and AzureRM.Scheduler modules
- Installs the OMSIngestionsAPI module
- Deploys an OMS workspace and installs the solution into the workspace
If you have tried to create such a solution before or any other ARM project, you know, there are many problems you will face.
So what is the current state of this solution?
- All the necessary components are being deployed and are working (I tested it only in the West Europe Azure location!)
- There are some parts with the OMS dashboard I need to update and adjust, but for the moment it works and offers a good demo case for an OMS solution.
- Be aware, it is not a production ready product, it is made for learning and testing. I tested it only briefly and I am not an Azure Scheduler MVP 😉 .
If you encounter any problems or things that don’t appear the way they should, let me know. Have fun!