Configuring Azure DevOps as Source Control for Azure Automation

In this step-by-step guide, we will walk you through the process of configuring Azure DevOps as your source control for Azure Automation, The video below that covers the process start to finish on how to set up Azure DevOps for Azure Automation. We also have a guide on how to convert interactive PowerShell scripts to in unattended scripts and move them to Azure Automation

YouTube Video

Understand the Benefits

Before you begin, it’s essential to understand the advantages of using Azure DevOps as your source control for Azure Automation. Azure DevOps offers centralized script management, version control, collaboration features, and change tracking.

1. Set Up Azure DevOps Account

Ensure you have an Azure DevOps account. If you don’t have one, creating an Azure DevOps Organization is straightforward and cost-effective, with the first 5 users being free, and a basic $5 per user license sufficing for script management. Visual Studio subscriptions also include Azure DevOps access.

  1. Visit the Azure Portal and search for “DevOps.”
  2. Create a DevOps Organization by providing a name and selecting the hosting region based on your preference.

2. Create a DevOps Project

Once you have an Azure DevOps account, create a new project. You can configure projects according to your use case, but for this example, let’s create a project named “Scripting” to hold your scripts.

  1. Access your Azure DevOps account.
  2. Create a new project, setting it up as needed.

3. Configure Your Project

Now, let’s configure your project to work with Azure Automation.

  1. Inside your Azure DevOps account, navigate to the “Repos” tab.
  2. The project will create a repository with the same name as the project, which is suitable for this example.
  3. To create a folder for Azure Automation syncing, you need to create a placeholder file since Git doesn’t allow empty folders. Create a placeholder file named “Placeholder.”
  4. Consider cloning the repository to your computer using Visual Studio Code for easier management.

4. Connect Azure Automation to Azure DevOps

Before connecting Azure Automation to Azure DevOps, configure some permissions.

  1. In “Project Settings,” navigate to “Security Policies” and enable 3rd party Application Access via OAuth.
  2. Add the managed identity from the Azure Automation Instance as a project contributor on the Azure DevOps Project. Note that this consumes a basic DevOps license.
  3. Ensure that the Azure Automation Managed Identity has contributor permissions on its own Azure Automation Instance.

Now, you can configure the source control in Azure Automation:

  1. Inside your Azure Automation account, go to the “Source Control” tab.
  2. Select “Add” and give the source control an intuitive name.
  3. Choose “Azure DevOps Git” as the source control type.
  4. Authenticate using your Azure DevOps account credentials.
  5. Select the repository and branch from the DevOps Project.
  6. If you’re focusing on a specific folder, specify the folder path.
  7. Turn on “Auto Sync” and leave “Publish Runbook” enabled.
  8. Click “Save” to save this configuration.

5. Move Your Scripts

Now, you can move your existing scripts into Azure DevOps:

  1. Use Visual Studio Code to copy your existing script from Azure Automation to a new file in the Azure DevOps Repository.
    • Note: If you’re not migrating existing scripts, you can start creating and saving your scripts directly in the Azure DevOps repository.
  2. Commit and push your automation script to the Azure DevOps repository. This enables Git’s version control features, allowing you to track changes and revert to previous versions if needed.

6. Enable Syncing in Azure Automation

Once your scripts are in Azure DevOps, you can enable syncing in Azure Automation. Wait for the syncing process to complete.

7. Test Your Scripts

After syncing, test your scripts to ensure they work as expected. Make any necessary adjustments or updates.

Additional Steps

You will have to add any PowerShell modules or Python packages that your scripts require in your Azure Automation account. This is crucial to prevent script failures.


Microsoft Documentation


Congratulations! You have successfully configured Azure DevOps as your source control for Azure Automation. This setup allows you to collaborate with your team, track changes, and maintain version control for your automation scripts.

Now, you can enjoy the benefits of centralized script management and efficient collaboration. Thank you for following this step-by-step guide, and feel free to leave any questions or comments below.