Azure Automation Account Runbooks

Raymond Raymond event 2021-12-24 visibility 431
more_vert
Azure Automation Account Runbooks

Azure Automation Account is provided for process automations. Once an automation account is created, you can use it to create runbooks. It currently support 5 runbook types: Graphical (PowerShell via Azure Portal), Graphical PowerShell Workflow (PowerShell Workflow via Azure Portal), PowerShell, PowerShell Workflow and Python.

Azure runbooks usages

Azure runbooks can be used for many different types of automation tasks, for example, start or stop Azure VMs, auto-scale of your Azure SQL Database based on schedule, send emails, backup or delete blobs, etc.

You can find many different templates from the gallery.

2021122402840-image.png

This article shows you a simple PowerShell textbook runbook that ping Kontext website every hour to give you a high-level idea about what you can do with Azure automation account.

Create an automation account

The first step is to create an automation account. In Azure Portal, search for Automation Accounts and then click '+ Create' button to create an account. 

2021122403036-image.png

Create runbook

  1. Go to Process Automation section of the automation account blade
    2021122403405-image.png
  2. Click Runbooks to view your existing runbooks or create a new runbook.
  3. Click button '+ Create a runbook'.
  4. Input the details.
    2021122403812-image.png
  5. Click button 'Create' to complete the creation of the runbook.
  6. In the editor, input the PowerShell scripts:
    2021122404431-image.png

  7. Click button 'Test pane' to test.
    2021122404209-image.png
  8. Click button 'Start' to start the test.
  9. Once the test is completed, the result will show as the following screenshot:
    2021122404528-image.png
  10. Go back to the editor and then click button 'Publish' to publish the runbook.
    2021122404615-image.png
  11. Once it is published, you can run, edit or delete it from the runbook blade:
    2021122404813-image.png

Create a scheduler

Once a runbook is created, you can create a scheduler for it.

  1. In the runbook blade, click Schedules under Resources category:
    2021122405030-image.png
  2. Click button '+ Add a schedule'.
  3. Click 'Link a schedule to your runbook':
    2021122405338-image.png
  4. Click a schedule or create a new one:
    2021122405427-image.png
  5. Click button Ok to save the change.
  6. After the schedule is linked, you can see the next run timestamp based on the schedule settings:
    2021122405611-image.png
  7. Once the runbook is executed, you can find the history in the Jobs section:
    2021122410138-image.png
  8. Click one job, you will be able to see all the details including output and all other logs:
    2021122410158-image.png

If you prefer Python, you can also use it to create runbooks. Enjoy process automation with Azure Automation Account!

More from Kontext
comment Comments
No comments yet.

Please log in or register to comment.

account_circle Log in person_add Register

Log in with external accounts