/ AzureAutomation

Getting started with Azure Automation

This is my first post in a series on how to get started with Azure Automations. In this first post we will set up the environment and test our first runbook.

Prerequisites

As always there are a few things we need, for this it's only an Azure Subscription and rights to create new services in this subscriptions. That's it. Yep.

Create your first Hello World Powershell Azure Runbook

Step by step instructions:

  1. Login to the Azure Portal and create an Azure Automation by selecting Create a resource and then search for Automation:
    1.CreateAutomation
    Click Create

  2. Fill in the form:
    2.CreateAutomation

Everything is pretty self explanatory except for the the Azure Run As Account. The difference from selecting no is basically that you get an Azure AD Application with a service principal you can use for your automations which makes it easier to authenticate your automations. More information here: Update your Automation account authentication with Run As accounts.

  1. Select the automation:
    3.CreateAutomation

  2. Scroll down to Process Automation and select Runbooks:
    4.RunBooks
    Click Add a runbook.

  3. Click Create a new runbook and fill in the form for your new Powershell runbook:
    5.fillintheform
    Click Create.

  4. Azure will take you to the following picture where you can start typing code and see all the available modules (and cmdlets available), Runbooks containing all runbooks in the automation and Assets with Credentials, Connections etc:
    6.readytoscript

  5. Lets create our first code snippet:
    7.hellowworld-1

  6. ... and test it by clicking Test Pane and then Start
    8.output
    Now click Publish!

  7. (bonus) To schedule this... impressive function click on Schedule -> Create a new schedule and fill in the form:
    9.schedule-1

Now you can schedule your HelloWorld function ;)

In a near future we will automate using custom credentials.

Enjoy ;)

Andreas Selevik

Andreas Selevik

Solution Architect specialized in Windows & Azure Architecture, Office 365, PowerShell, Identity management and automation. Manchester United fanatic, father, husband and a very good winner...

Read More