One of my favorite things is automating processes so you will comply to governance and guidelines set by an organization, and you don’t have to keep repeating manual steps. This week I created a PowerShell script, as part of a self-service Azure DevOps solution, to update team configuration settings for Azure DevOps teams.

The easiest way to do this, is to invoke Azure CLI and Azure DevOps Extension commands with PowerShell, in this particular case; the az devops invoke command. You could also fallback on using the Azure DevOps API, but Azure CLI is esier to use, and is my prefered tool to use in other solutions as well. The az devops invoke will invoke request for any DevOps area and resource, so I use it when there isn’t a command available yet.

Note: Did you know that 'Azure CLI' and 'Azure DevOps Extension' are available on Microsoft-hosted agents, thus easy and ready to use in Azure pipelines.

Features

  • Update ‘General’ team configuration settings:
    • Bugs behavior
    • Backlog visibilities
    • Working days

Business value

  • Higher productivity due to easy and ad-hoc team setup
  • Less work, less sensitive to errors, less need for knowledge at operational level
  • A standardized process of teams creation that respects customer’s governance, security and compliance policies

Preview


team configuration settings

Team configuration sample

By defining a JSON-formated string value, you will be setting the team configuration settings.

$settingsJson = @{
    "bugsBehavior" = "asRequirements"
    "backlogVisibilities" = @{
        "Microsoft.EpicCategory" = $true
        "Microsoft.FeatureCategory" = $true
        "Microsoft.RequirementCategory" = $true
    }
    "workingDays" = @(
        "monday", 
        "tuesday", 
        "wednesday", 
        "thursday"
    )
} | ConvertTo-Json -Depth 99

Just set the -TeamSettings parameter of the script with the JSON-formated string value and run the command.

.\Update-ADOTeam-Settings.ps1 `
    -Organization $env:ORGANIZATION -ProjectName $env:PROJECT_NAME `
    -TeamName $env:TEAM_NAME -TeamSettings $settingsJson -Verbose

That’s it 👊, happy automating!

Source code

Tools and technologies