Adding a Hybrid Runbook Worker for Azure Automation
By Jesse Walter
Published November 11, 2015
Estimated Reading Time: 3 minutes

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:

AA_000055 AA_000056

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:

AA_000068 AA_000069

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.



Article By Jesse Walter
Jesse Walter is a Partner with Model Technology Solutions and the Vice President of Research and Development. He has an extensive background in Microsoft endpoint management tools, such as Microsoft Endpoint Configuration Manager and Intune, as well as a strong foundation in the Microsoft 365 Defender stack. Additionally, he enjoys automating repeatable operational tasks using PowerShell, and has developed several security tools using C#.

Related Posts