Create an Azure automation runbook

Video guide

Here is a video guide which I created for the Patch My PC report which covers the steps outlined below.

Import Modules

If you wish to export data to an Azure storage account, you will need a couple of PowerShell modules added to the automation account for the runbook to use.

  • In the Azure portal in the automation account, go to the Modules gallery pane

  • Search for and import the following modules:

    • Az.Accounts

    • Az.Storage

Create a Runbook

  • Click on the Runbooks pane and choose Create a runbook

  • Enter a name for the runbook, select PowerShell for the runbook type and click Create

  • Here you can enter your PowerShell code. To get started, check out the included examples for exporting to an Azure storage account and exporting to a Log analytics workspace.

    • If you wish to test the runbook before publishing to make sure it works, use the Test pane

    • Alternatively, Publish the runbook, then click Start from the runbook menu. This option will give you the full output of the script.

  • When ready, Publish the runbook

Schedule the Runbook

Schedule the Runbook to execute at regular intervals to keep the data updated.

  • In the Azure portal, in the automation account, open the Runbook you created

  • Click Link to schedule

  • In the Schedule section, select an existing schedule or create a new one

Last updated