Azure Automation Version Control with PS7

computerpaul2 26 Reputation points
2024-09-13T15:27:40.9466667+00:00

We've been trying to migrate our runbooks to runtime 7.2, but there's still a few hangups that are making the migration hard to justify. One of them is that version control with ADO is not officially supported per MS documentation. That being said, I have several runbooks that were setup in the past that are successfully syncing from ADO to AA. However, more often than not, when I try to create a new 7.2 runbook, the sync simply fails with a "400 Bad Request".

Does Microsoft plan on supporting version control in the future? Should we be using something else? Has anyone else found a workaround for getting 7.2 runbooks to sync with version control?

Azure Automation
Azure Automation
An Azure service that is used to automate, configure, and install updates across hybrid environments.
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Amira Bedhiafi 41,111 Reputation points Volunteer Moderator
    2025-05-27T18:27:06.1733333+00:00

    Hello Paul !

    Thank you for posting on Microsoft Learn.

    You're right, as of now, Azure Automation does not officially support Git-based source control integration (like Azure DevOps or GitHub) for PowerShell 7.2 runbooks. This is a known limitation, and many teams encounter issues like the 400 Bad Request error when attempting to link or sync PS7.2 runbooks via version control mechanisms that worked for PS5.1.

    Microsoft source control integration for Azure Automation was originally built around PowerShell 5.1 and Python 2/3, and the tooling (especially for the GitSync backend) has not been updated to accommodate PowerShell 7.2. When you attempt to sync a 7.2 runbook using the Azure DevOps integration UI, the system may reject it due to incompatible or missing metadata, which triggers the 400 error.

    Microsoft has not officially announced support for source control (Git integration) for PowerShell 7.2 runbooks in Azure Automation.

    The roadmap for Azure Automation increasingly emphasizes Azure Functions and GitHub Actions, which offer first-class DevOps integration and support PS7+.

    You can automate the sync yourself via DevOps pipelines by storing the .ps1 runbooks in your ADO repo and use an Azure DevOps release pipeline or GitHub Action to deploy the scripts using the Azure Automation API or Az PowerShell module:

    $runbookPath = "path\to\Runbook.ps1"
    $automationAccount = "MyAutomationAccount"
    $resourceGroup = "MyResourceGroup"
    $content = Get-Content $runbookPath -Raw
    Set-AzAutomationRunbook `
      -AutomationAccountName $automationAccount `
      -Name "RunbookName" `
      -ResourceGroupName $resourceGroup `
      -Type PowerShell7 `
      -Description "Updated via pipeline" `
      -Content $content
    

    If you’re open to platform changes, Azure Functions or GitHub Actions support native PS7 environments, source control, CI/CD, and better integration for modern workflows.

    You can even create "runbook-style" workflows using GitHub Actions or Logic Apps for recurring tasks.

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.