How to: List all pools, agent and capabilities of self-hosted agents

This script list all pools, agents and capabilities on Azure DevOps organization

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

Let’s go understand each used command.

  1. PowerShell script will receive the following parameters:
  • $PAT = Personal Access token to connect on Azure DevOps;
  • $Organization = Organization URL to list all users and permissions.

2. Get Agent Pools = use this command to list all Agent Pools on Azure DevOps organization.

3. Get Agents = use this command to list all agents and capabilities on the respective pool.

4. After executing the script on PowerShell, will be generated a JSON file that lists all pools, agents, and your respective capabilities.

5. After creating JSON, I connected it on Power BI, as shown below:

  • Pools (1): filter a respective poll to agents;
  • Agents (2): list respective capabilities to a specific agent;
  • Capabilities (3): list all capabilities on a respective agent.

DevOps Consultant at N3