404
404

Reputation: 29

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

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

Upvotes: 1

Views: 1990

Answers (1)

Joy Wang
Joy Wang

Reputation: 42043

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://learn.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate?view=azure-devops&tabs=preview-page

Upvotes: 3

Related Questions