Azure Automation
Azure Automation enables users to automate tasks that are manual and repetitive in nature by using Runbooks. Runbooks are nothing but a set of tasks that perform some automated implementation in Azure Automation.
Runbooks in Azure Automation are based on Windows PowerShell or Windows PowerShell Workflow. We can code and implement the logic that we want to automate using PowerShell.
Azure Automation Accounts
Before getting started with Azure Automation, we have to create Automation Accounts which will be used to authenticate the runbooks. When we create a new Automation account in the Azure portal, it automatically creates a Run As Account and a Classic Run As Account.
Create Automation Accounts
We can create the Automation accounts by going to the new Azure Management Portal. From Developer tools, select "Automation".
This will open up the Azure Automation Account creation page. Specify the below parameters which will be used to create the Azure Automation Account:
- Name - The name of the Azure Automation Account
- Subscription - Specify the name of the subscription. If you have any free subscriptions, we can chose that as well. Check here to get a free 12 months Azure Subscription credits under Developer Program Benefit scheme.
- Resource Group - Either create a new resource group or choose an existing one we have already created.
- Location - Specify Azure datacenter Location.
- Select ‘Yes’ for ‘Create Azure Run as Account’
Finally, after filling up all the details, click on Create.
This will create an Azure Automation Account as shown below. As part of the account, we will have a Run as Account as well as a Classic Run as Account provisioned. Each of these accounts will have few resources allocated by default which include default runbooks.
Clicking on it will take us inside the automation account.
Before moving ahead, we have to see if the accounts (Run As Account and Classic Run as Account) can successfully authenticate. In order to check it, click on Runbooks tile.
Test Run As Account
We will test the authentication of Run as account using the below runbook. Click on the Azure ‘AutomationTutorialScript’.
Click on "Start" to run the runbook.
Intially, the runbook will be queued which indicates that it is waiting for a runbook worker in the cloud.
It will change to the Running state when the runbook has actually started running.
Finally, it will show the completed message indicating successful completion if there are no errors. We can check the Output by going to the Output tile.
Test Classic Run As Account
We will test the Classic Run As account just like how we tested the Run As Account. The only difference is that we will be using the runbook – ‘AzureClassicAutomationTutorialScript’.
Click on "Start" to run the runbook.
It has successfully run to completion.
This ensures that the created accounts have appropriate privileges to run the runbooks in Azure Automation.
Summary
Thus, we saw how to create Azure Automation Accounts and how to test the access privileges of the created accounts. In the upcoming article, we will see how to create Azure Runbooks.