Thursday, January 29, 2015

Automating your Azure infrastructure with Runbook management

With Azure automation, it’s now very easy to automate all your long running manual tasks that are repetitively executed in the Azure infrastructure with the help of PowerShell workflows that results in less errors in a better managed way. You can automate the creation, monitoring, deployment, and maintenance of resources in your Azure environment using the Azure Automation solution for Azure.

To create a runbook, you need to first create an Automation account on the Azure portal.
After creating the automation account, click on the account and select Runbook from the dashboard

Click New and create a runbook with a title and description as given below

This will open the runbook edit workspace on the portal.

Automation runbooks are implemented as Windows PowerShell workflows. As you can see from the editor window, the workflow starts with a workflow keyword followed by the name of the workflow. You can add parameters and script to the body as in any other PowerShell cmdlet. In this example, I’ve just used a string parameter to get an input from the user and used a Write-Output to output a message.

Click on Test button on the bottom panel to test the runbook in the same window.

Once tested and saved, you can publish the workflow by clicking the Publish button

Click Start to invoke the workflow
Provide the values for parameters and click OK.

Once the workflow has started you can track the progress and result on the Job tab as given below