Learn how to create Azure Automation Accounts
How to Create Automation Accounts in Azure
An Automation Account in Azure is a container that holds all your automation resources, such as runbooks, schedules, variables, credentials, and configurations. Creating an automation account is the first step to automating tasks in Azure, such as managing virtual machines, applying patches, or using Azure Automation to manage resources.
You can create an Automation Account using the Azure Portal, Azure CLI, or Azure PowerShell.
Below are the steps for each method.
1. Create an Automation Account Using the Azure Portal
Here are the steps:
Log in to the Azure Portal:
Go to Azure Portal.
Navigate to Automation Accounts:
In the left sidebar, search for "Automation" in the search bar, or go to All Services → Management + Governance → Automation Accounts.
Click on "Create":
Click the + Create button to start the process of creating a new Automation Account.
Fill in the Required Details:
Subscription: Choose the Azure subscription where you want to create the automation account.
Resource Group: Choose an existing resource group or create a new one.
Name: Provide a unique name for your automation account (e.g.,
MyAutomationAccount).Region: Choose the region where the automation account will be located (e.g.,
East US).
Create Azure Run As account:
Select Yes to create a Run As account (this is used for authenticating the automation account to Azure resources).
Review + Create:
After filling in the details, review your selections. If everything looks good, click Create to create the automation account.
Wait for Deployment:
Azure will deploy the automation account. Once completed, the Automation Account will appear in your resource list.
2. Create an Automation Account Using Azure CLI
You can create an automation account using the Azure CLI, which is a cross-platform tool that allows you to manage Azure resources via the command line.
Prerequisites:
Azure CLI must be installed on your machine. You can install it by following the instructions here.
Make sure you're logged in using the following command:
xxxxxxxxxx11az loginFollow the steps below:
Create a Resource Group (if you don’t already have one):
xxxxxxxxxx31az group create \2--name MyResourceGroup \3--location eastusCreate the Automation Account:
xxxxxxxxxx41az automation account create \2--name MyAutomationAccount \3--resource-group MyResourceGroup \4--location eastusReplace
MyAutomationAccountwith the name you want to use for your automation account.Replace
MyResourceGroupwith your desired resource group.Choose the location (e.g.,
eastus).
Verify the Automation Account:
After creating the automation account, you can verify it with the following command:
xxxxxxxxxx31az automation account show \2--name MyAutomationAccount \3--resource-group MyResourceGroup3. Create an Automation Account Using PowerShell
You can also create an Automation Account using Azure PowerShell. Before starting, ensure you have the Az PowerShell module installed. You can install it by running the following command in PowerShell:
xxxxxxxxxx11Install-Module -Name Az -AllowClobber -Force -SkipPublisherCheckHere are the steps:
Log in to Azure:
xxxxxxxxxx11Connect-AzAccountCreate a Resource Group (if not already created):
xxxxxxxxxx11New-AzResourceGroup -Name MyResourceGroup -Location EastUSCreate the Automation Account:
xxxxxxxxxx11New-AzAutomationAccount -ResourceGroupName MyResourceGroup -Name MyAutomationAccount -Location EastUSVerify the Automation Account:
After creating the automation account, you can check the account details using the following command:
xxxxxxxxxx11Get-AzAutomationAccount -ResourceGroupName MyResourceGroup -Name MyAutomationAccount4. Create an Automation Account Using ARM Templates
You can also automate the creation of an Automation Account by using an Azure Resource Manager (ARM) template. This is especially useful for replicating automation accounts across multiple environments.
Example ARM Template:
xxxxxxxxxx171{2 "$schema": "https://schema.management.azure.com/schemas/2019-08-01/deploymentTemplate.json#",3 "contentVersion": "1.0.0.0",4 "resources": [5 {6 "type": "Microsoft.Automation/automationAccounts",7 "apiVersion": "2020-01-13",8 "location": "EastUS",9 "properties": {10 "sku": {11 "name": "Free"12 }13 },14 "name": "MyAutomationAccount"15 }16 ]17}Deploy ARM Template:
You can deploy this ARM template using the Azure CLI:
xxxxxxxxxx31az deployment group create \2 --resource-group MyResourceGroup \3 --template-file automation-account-template.json5. Managing Automation Accounts
Once you've created an automation account, you can manage it through the Azure Portal, CLI, or PowerShell.
Some key management tasks include:
Adding Runbooks: Automate tasks using scripts (e.g., PowerShell, Python).
Creating Schedules: Schedule your runbooks to run at specific intervals.
Setting Up Update Management: Automate patch management for your VMs.
Configuring Credentials: Store and securely manage credentials for accessing resources.
Enabling Hybrid Runbook Worker: For automation on on-premises or hybrid environments.
Summary
Creating an Azure Automation Account is a straightforward process, and it can be done via the Azure Portal, Azure CLI, PowerShell, or ARM templates. Once the account is created, you can use it to manage your cloud and hybrid resources, automate various tasks, and improve operational efficiency.






















Leave a Reply