How to: Environments, Approvals, and Checks Mapping on Azure DevOps

This script and report extract all Environments and respective Approvals, and Checks to Multi-Stage Pipeline YAML on each Team Project within Azure DevOps

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 Environments, Approvals, and Checks on Azure DevOps organization;
  • $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 = use this REST API to list all projects on the Azure DevOps organization.

3. Environments List = use this REST API to list all Environments on each Team Project

4. Check Configurations Query = use this REST API to list all Approvers and Checks on each Environment

5. After extract all Environments, Approvals, and Checks, 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;
  • Environment (2) = Filter report using Environment field;
  • Approvals and Checks (3) = Filter report using Approvals and Checks types.
  • Report Information (4) = List all information about Environments, Approvals, and Checks. If the respective approval and check appear in this mapping, the same will be marked (green ticks on a grid).

One more time, I wanted to thank Ewerton Rodrigues Jordão and Gustavo Scatolin Bergamin for their great help with PowerShell and Willy-Peter Schaub for their great ideas with new reports.

DevOps Consultant at N3