Azure CLI Command to list the agent pools and the jobs run

Viewed 242

Is there an Azure CLI Command which can list the agent pools and the jobs run in them ?

1 Answers

To list the agent pools, you could use az pipelines pool list.

az pipelines pool list [--action {manage, none, use}]
                       [--detect {false, true}]
                       [--org]
                       [--pool-name]
                       [--pool-type {automation, deployment}]
                       [--query-examples]
                       [--subscription]

To list the jobs run in them, there is no built-in CLI command, the workaround is to call the REST API GET https://dev.azure.com/{organiztion}/_apis/distributedtask/pools/{poolId}/jobrequests?api-version=6.0 directly, e.g. via CURL, Powershell.

CURL sample:

curl -u :<PAT> https://dev.azure.com/{organiztion}/_apis/distributedtask/pools/{poolId}/jobrequests?api-version=6.0

Reference - https://docs.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate?view=azure-devops&tabs=preview-page

Related