Create Automation Account with Powershell

Login-AzureRmAccount
Set-AzureRmContext -SubscriptionId "your subcription id"
$ResourceGroupName='test-rg'
    $aaName='testaa'
$Location='Southeast Asia'
    $aa=Get-AzureRmAutomationAccount -ResourceGroupName $ResourceGroupName -Name $aaName -ErrorAction Ignore

    if(($aa | Measure-Object).Count -eq 0)
{
        $aa = New-AzureRmAutomationAccount -Name $aaName -Location $Location -ResourceGroupName $ResourceGroupName
    }

Comments