Operations Management Suite (OMS) || Operational Validation Tests (OVT) (Pester) || Azure Automation

I have been looking for a way to display the current status of environments using Operation Validation Tests (OVT) and Operations Management Suite (OMS). When the Operations Management Suite API came out, this became possible ( https://blogs.technet.microsoft.com/msoms/2016/08/30/http-data-collector-api-send-us-data-from-space-or-anywhere/ ).

Not wanting to make things difficult for myself I searched the PowerShell Gallery for any modules that might help with data ingestion into OMS.  I found one had already been written by Tao Yang ( https://www.powershellgallery.com/packages/OMSDataInjection/1.0.1 ).

The solution consists of Azure Automation Hybrid Workers, OMS, Azure Automation Runbook, Azure Automation Assets and Pester based OVT’s stored on Azure Blob Storage.

Automation Runbook

This is a POC RunBook that requires more work but it is functional.

Make sure any modules required for your tests are loaded onto the Hybrid RunBook workers. Best practice would be to use PowerShell remoting to avoid loading modules onto the Hybrid Runbook Workers.

One module that does need loading on to the Hybrid Runbook Workers and into Azure is the OMSDataInjection module.

 

OVT – Pester

I decided to use the Describe element of the Pester tests to separate the services shown in OMS. This means that new OVT’s can be added without changing any code in the Runbook or any searches in the OMS view.

The below shows as one service in OMS.

The below shows as three services in OMS

 

OMS Searches

If you look in the Runbook above a variable called $ovtRun is being auto increased by one every time the Runbook is ran. This allows test runs to be grouped in OMS which then allows only the latest Passed\Failed OVT’s to be shown. The base query for this is below which uses the IN method.

OMS OVT Tile Overview

OMS View One

OMS View Two

Next Steps:

  • Package the solution as a JSON ARM template with Automation Account and Required Runbooks.
  • Add weighting to the OVT rules so failed tests can be prioritized in the view.
  • Remove the need for the Hybrid Runbook workers to require the use of a Run As account.
  • Remove environment information from the tests.ps1 files and store separately.

 

About the author

Ben Taylor

Cloud and PowerShell enthusiast with a penchant for automation and CI.

View all posts

Leave a Reply

Your email address will not be published. Required fields are marked *