How to: Project Stats Mapping on Azure DevOps

This script and report extract all Project Stats (including Boards, Repos, and Pipelines information) within the Azure DevOps organization

Many customers that use Azure DevOps need to identify if projects on your organization are being used. When you navigate a specific project, you have a feature named View project activity, but you have this view only within the project. This report will show this mapping with all the projects in the organization based on the last 30 days' activities.

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 Proejcts and Stats 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 = uses this REST API to list all Team Projects on Azure DevOps organization

3. Contribution HierarchyQuery = uses this REST API to get the Project stats section on the landing page on Azure DevOps

4. Get Project Metrics = uses this REST API to get build metrics for a project

5. Get Release Metrics = uses this REST API to get releases metrics for a project

6. After extract all Team Projects and Stats (including Boards, Repos, and Pipelines), this information is stored in a table in Azure SQL.

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

  • Project Name(1) = Filter report using Project Name field;
  • Project Stats Mapping (4) = List all information about Team Project and Stats (including Boards, Repos, and Pipelines).

One more time, I wanted to thank Ewerton Rodrigues Jordão for the great help with PowerShell.

DevOps Consultant at N3