Azure automation: Start-AutomationRunbook – New simple way to start runbook jobs from within a runbook!

Microsoft has just released a new cmdlet in the realm of Azure automation.


The cmdlet is designed to start runbook jobs in the same account as the current running runbook, without having to define any endpoints/credentials/etc.

Syntax is:

By |2015-11-20T15:33:22+00:00November 20th, 2015|Automation, Azure|6 Comments

About the Author:

Jakob Gottlieb Svendsen

Twitter: @JakobGSvendsen

Jakob Gottlieb Svendsen is a Microsoft Cloud and Data Center Management MVP (, Working as Global Lead Developer, Senior Consultant and Trainer at CTGlobal, where he is one of the driving forces in keeping CTGlobal a System Center Gold Partner and member of the System Center Alliance.

Since he started at Coretech in 2007, he has focused on Scripting and Development, primarily developing tools, extensions and scripts for the System Center Suite. His main area is Automation (including OMS/Azure Automation, Service Management Automation, PowerShell and Orchestrator). Another area is Windows Azure Pack / Azure Stack, where he does implementation, development, workshops and presentations. He is a world-wide renowned voice in the Automation field.

He is passionately devoted to the community, to which he contributes by being a moderator at TechNet and sharing his knowledge at

  • Co-founder: PowerShell User Group Denmark
  • Speaker at MMS 2016, Minneapolis (
  • SCU Europe 2014, 2015, 2016 (
  • Microsoft TechEd North America 2014, Houston
  • NIC 2012,2013,2014,2015, Oslo (
  • Microsoft CampusDays 2011, 2013, Copenhagen
  • Microsoft TechDays 2015, Sweden (
  • Microsoft Partner Event: New in SC2012 SP1
  • User group meetings (PSUG.DK , SCUG.DK/BE/NO, AZMUG + more)
  • Microsoft Certified Trainer.
  • Microsoft Scripting Guys Forum Moderator

Main working areas:

  • Automation (Azure Automation, SMA, SCO)
  • Windows Azure Pack / Azure Stack
  • System CenterVisual Studio Team Services / Team Foundation Server
  • Development:C#.Net, VB.NET, VBScript, PowerShell, Service Manager, OpsMgr, ConfigMgr
  • Orchestrator
  • Windows Azure Pack / Azure Stack


  • Azure Automation
  • Service Management Automation
  • System Center Orchestrator
  • PowerShell, VBScript, C#.Net, VB.Net
  • Windows Azure Pack / Azure Stack Development Workshops


  1. Jarko November 25, 2015 at 14:10 - Reply

    That CMDLet could be really useful, great info!

    How do I monitor runbook job output and status?

    Get-AzureAutomationJob and Get-AzureAutomationJobOutput as usually?

    • Neil January 27, 2016 at 18:58 - Reply

      Did you ever find out how to get the Job Status? Those 2 cmdlets dont work and there doesnt seem to be a:
      Get-AutomationJob cmdlet etc?

      • Jarko February 18, 2016 at 9:33 - Reply

        Nope, did not, hoping for some info from Jakob 🙂

        • Jakob Gottlieb Svendsen
          Jakob Gottlieb Svendsen February 24, 2016 at 18:05 - Reply

          sorry for the late reply. Unfortunately there is not a GEt-AutomationJoboutput command and I think we’re supposed to use Get-AzureAutomationJobOutput, but I am having problems too at the moment

          • Jakob Gottlieb Svendsen
            Jakob Gottlieb Svendsen February 24, 2016 at 21:24

            So I finally got it tested properly.
            I also had problems using the cmdlets, but it was because I had uploaded my own versions of some of the azure modules. Either you need to use the provided (globa) ones or upload all of them yourself. I updated this blog with the information:

            but unfortunately you have to use the stnadard commands, which means you could easily use the normalt Start-AzureRMAutomationrunbook instead

            Here is a code example:

            $cred = Get-AutomationPSCredential -Name ‘DefaultAzureCredential’
            Login-AzureRmAccount -credential $cred

            $PSDefaultParameterValues = @{
            “*AzureRMAutomation*:ResourceGroupName” = “xx-West-Europe”
            “*AzureRMAutomation*:AutomationAccountName” = “xx”

            $JobId = Start-AutomationRunbook –Name “Test-Output”

            Write-Output “Job Started:”

            $Status = $null
            do {
            if($Status -ne $null)
            “Job not complete – Status: $Status – Sleeping”
            Start-Sleep -Seconds 2

            $Status = Get-AzureRMAutomationJob -Id $JobId | Select-Object -ExpandProperty Status

            } while (($status -ne “Completed”) -and ($status -ne “Failed”) -and ($status -ne “Suspended”) -and ($status -ne “Stopped”) )

            if($status -eq “Completed”)
            Get-AzureRmAutomationJobOutput -id $JobId -Stream Output | Get-AzureRmAutomationJobOutputRecord
            Get-AzureRmAutomationJobOutput -id $JobId -Stream “Any” | Get-AzureRmAutomationJobOutputRecord

  2. […] of the ‘Start-AutomationRunbook’, described in Jacob Gottlieb’s blog-post here: Start-AutomationRunbook. In the comment section, it is discussed, how to monitor the job […]

Leave A Comment