How to: Deployment Groups and Release Definitions Mapping on Azure DevOps

This script and report extract all Deployment Groups and respective Release Definitions that usage them within the Azure DevOps organization

An original script is available on my GitHub repository. See below this script:

Let’s go understand each command used.

  1. PowerShell script will receive the following parameters:
  • $PAT = Personal Access token to connect on Azure DevOps;
  • $Organization = Organization URL to list all Deployment Groups and respective Release Definitions that usage them;
  • $Connstr = connection string to Azure SQL Database that stores the report information. To create this report, it’s necessary to create previously a Azure SQL Server and Database and run a script below:

2. Projects List = uses this REST API to list all Team Projects on Azure DevOps organization

3. Definitions List = uses this REST API to list all Release Definitions on each Team Project

4. Deploymentgroups Get = uses this REST API to get Deployment Group on each Release Definition and Stage Name

5. After extract all Deployments Groups and Release Definitions, this information is stored in a table in Azure SQL.

6. After insert information into a table, I connected this database on Power BI:

  • Team Project (1) = Filter report using Team Project field;
  • Release Definitions Name (2) = Filter report using Release Definition Name field;
  • Deployment Group Name (3) = Filter report using Deployment Group Name field;
  • Information (4) = List all information about Projects, Release Definitions, and Stage Names (on rows), and respective Deployment Group Name (on columns). If the Release Definition uses the respective Deployment Group, the same will be marked (green ticks on a grid). If you mouse over on the respective cell, will be show information about Phase Name and Machine Name from Deployment Group.

DevOps Consultant at N3