Beginner Guide to Azure Automation !

Azure Automation

For Azure IAAS enthusiasts, Microsoft has provided a platform to automate all the azure services using powershell. The language is tweaked and used as “powershell workflow”.

 

Why to Use

  • Reducing Manual Effort and help in consistent testing
  • Managing resources (deployment/VM’s etc)

 

How to Use

  • Create a powershell workflow in azure web portal and execute it.

Runbook

  • Deployment and execution of tasks written in PowerShell.
  • Provisioning/Deployment/Maintenance/Monitoring.

 

Things to know!

Automation Account – A dedicated account to perform runbook design/execution/management.

Asset – Global resources used by runbooks to assist in common tasks and value specific operations

Windows PowerShell Workflow – Implementation of azure automation using PowerShell Workflows. Workflow is a group of individual steps performing an action.

Management Certificates – Authenticate azure resources for azure automation in an azure subscription.

 

Tips to remember!

  • An automation account name is unique per region and per subscription. Multiple accounts are possible. Max 30 per subscription in different region.

 

Sample One: Creating a runbook to Connect Azure Subscription using Azure AD

Create Automation Account

1. Goto https://portal.azure.com 1

2. Click Browse and select Automation Accounts.

2

 

 

3. Click Add in the Automation accounts.

3

 

4. Fill details in Add Automation Account and click Create.

4

 

 

 

 

 

 

5. Automation Account is created. 5

 

6. In Automation Resources, Select Runbooks.

6

7. Click Add Runbook. Enter details and click create.

7

 

 

8. Runbook is created. Authoring status is New.

8

9. Click Edit in the Runbook details page.

 

9

 

 

10. Create an Azure AD User to the subscription and set it as a co-administrator. Add the user to the asset as credential type.

10

11.Edit the Runbook with the below code and Save the runbook.

11

 

 

12. Test the runbook by clicking Start in the Test Pane.

12

 

13. Test is passed.

13

 

 

 

 

 

 

 

14. Publish the runbook by clicking publish in the Runbook detail page.

14

 

15. You can schedule the run book based on the Recurrence/Date etc.

15