Setup and run a Azure automation runbook

A runbook can help you to run scripts on a schedule or trigger them with a webhook. You can either run them in Azure or on your on-premises server. This example will show how to run a script on a on-premises that is connected to Azure Arc.

First step is to create an automation account in your favorite region. You might need to create a resource group as well.

Go to your newly created automation account and look for Hybrid worker groups.

Create a new hybrid worker group and select a name.

Now we have a Hybrid worker group without any hybrid workers. Click hybrid workers to the left

Click add

Select one or more servers and add them to your hybrid worker group. If your list is empty you need to enable Azure Arc at least on one server.

Back to automation account and press Runbooks.

Create a new runbook

Give the runbook a name and select type. In this example Powershell och runtime version 5.1.

Now to the fun part, edit the new runbook and write or paste your script. Select publish when done.

When pressing start a meny to the right enables you to select to start the runbook and let it run on a server in your hybrid worker group.

When the runbook is finished we can view the output or errors. The last line shows the name of the server the script was executed on. Can be useful for troubleshooting if the hybrid worker group contains multiple servers.

To make more use of this capability ro trigger script on a local server from Azure start explore schedules and webhooks.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.