Posts tagged ‘Automation’

Start Azure Automation runbook from powershell

With the new Azure Automation cmdlets I wrote about in the previous post we are now able to start runbooks from outside of Azure.
Here is an example how to start a runbook and also get the output from the runbook:

$AzureAccount = "Name of Azure Automation Account"
$RBname = "Name of runbook to start"
$Params = @{"Param1" = "Value1";"Param2" = "Value2"}

$RBjob = Start-AzureAutomationRunbook -AutomationAccountName $AzureAccount -name $RBname -Parameters $Params

DO {
    $RBjobId = Get-AzureAutomationJob -AutomationAccountName $AzureAccount -id $RBjob.Id
    $RBjobstatus = $RBjobId.Status
    } Until ($RBjobstatus -eq "Completed")

Get-AzureAutomationJobOutput -AutomationAccountName $AzureAccount -Id $RBjob.Id -stream Any

Azure Automation Powershell cmdlets

With the Azure Tool kit being updated last week we got a couple of cmdlets for Azure Automation, so now we are able to start, stop get jobs and so on from our runbooks in Azure Automation from on-premises.

Here are the new cmdlets:

To download the updated powershell module go here:

For reference on the new cmdlets, go here: