Hey, everybody. Hope you are doing well. If you’re not, you are about to be doing better, for I am going to embed a pre-release of “The Force Awakens” below!
I lied, but you made it past the first line of my blog, and now I have you!
Instead, what I really want to show you is how to leverage Azure Automation to manage multiple environments using the Microsoft Management Agent (from OMS), hybrid runbook workers, and Azure. I’m going to assume that you have Azure and Operational Insights accounts, but if you do not, click on the links and get started! After your accounts are created, the setup of your hybrid runbook worker is pretty easy, and the functionality is much cooler than any Star Wars movie (please don’t hate me for saying that). So let’s get started! (NOTE: Your hybrid runbook worker must be on Server 2012 or better, and you must be running Powershell 4.0 or higher)
First, go to your Azure portal, click New > Management > Automation Account, create a name for your Automation Account, customize your settings to your liking, and click OK:
Next, go to All Resources and select your new Automation Account:
Next, go to your OMS portal and select Settings:
Here, you can download the Microsoft Management Agent and note your Workspace ID and key used to connect the agent to OMS:
On the server in which you would leverage as your hybrid runbook worker, run the MMA setup and ensure you check Connect the agent to Microsoft Azure Operational Insights:
Add the Workspace ID and Workspace Key that you noted previously:
After installation is complete, launch Powershell and import the module HybridRegistration.psd1 located (assuming you installed the agent to C:) at c:\Program Files\Microsoft Monitoring Agent\Agent\AzureAutomation\<current version>\HybridRegistration. NOTE: if you have installed WMF 5 (still in preview for server as of this post), then you can simply run Install-Module Azure to import (well, install now, I suppose) the module:
After importing the module, go back to the Azure portal and grab the URL Endpoint and Key you will use to connect the hybrid runbook worker to your Automation space:
Back on the server, run the command Add-HybridRunbookWorker -Name <name> -Endpoint <copied URL string> -Token <copied key>:
Once complete, go back to the portal, and within 5 minutes you should see a new Hybrid Worker Group! (the exclamation point gets you excited):
Now you can launch your runbooks on your hybrid worker!
Happy automation! Oh, and sorry I lied.