Loading...
Loading...
Azure DevOps operations via az CLI. Always when working with Azure Devops for repository management and pull requests.
npx skill4agent add jimweller/clanker-skills adoaz$AZURE_DEVOPS_EXT_PATdev.azure.comvisualstudio.com$ADO_DEFAULT_ORG$ADO_DEFAULT_PROJECTorg="${org:-$ADO_DEFAULT_ORG}"
project="${project:-$ADO_DEFAULT_PROJECT}"az--org "https://dev.azure.com/${org}"--project "$project"azremote_url=$(git remote get-url origin 2>/dev/null)https://dev.azure.com/{org}/{project}/_git/{repo}https://{user}@dev.azure.com/{org}/{project}/_git/{repo}clean_url=$(echo "$remote_url" | sed 's|https://[^@]*@|https://|')
org=$(echo "$clean_url" | sed -n 's|https://dev\.azure\.com/\([^/]*\)/.*|\1|p')
project=$(echo "$clean_url" | sed -n 's|https://dev\.azure\.com/[^/]*/\([^/]*\)/_git/.*|\1|p')
repo=$(echo "$clean_url" | sed -n 's|.*/_git/\(.*\)|\1|p')https://{org}.visualstudio.com/DefaultCollection/{project}/_git/{repo}clean_url=$(echo "$remote_url" | sed 's|https://[^@]*@|https://|')
org=$(echo "$clean_url" | sed -n 's|^https://\([^.]*\)\..*|\1|p')
project=$(echo "$clean_url" | sed -n 's|.*/DefaultCollection/\([^/]*\)/_git/.*|\1|p')
repo=$(echo "$clean_url" | sed -n 's|.*/_git/\(.*\)|\1|p')git@ssh.dev.azure.com:v3/{org}/{project}/{repo}org=$(echo "$remote_url" | sed -n 's|git@ssh\.dev\.azure\.com:v3/\([^/]*\)/.*|\1|p')
project=$(echo "$remote_url" | sed -n 's|git@ssh\.dev\.azure\.com:v3/[^/]*/\([^/]*\)/.*|\1|p')
repo=$(echo "$remote_url" | sed -n 's|.*[^/]*/\([^/]*\)$|\1|p')%20base_url=https://dev.azure.com/{org}/{project}/_git/{repo}
pr_url={base_url}/pullrequest/{pr_id}open "$url"open "https://dev.azure.com/${org}/${project}/_git/${repo}"open "https://dev.azure.com/${org}/${project}/_git/${repo}/pullrequest/${pr_id}"az devops project list --organization "https://dev.azure.com/${org}" --query "value[].{Name:name,ID:id,State:state}" -o tableaz devops project show --project "$project" --organization "https://dev.azure.com/${org}"az devops project show --project "$project" --organization "https://dev.azure.com/${org}" --query id -o tsvaz repos create \
--name "<repo-name>" \
--project "$project" \
--org "https://dev.azure.com/${org}" \
--output table \
--query "{Name:name,Project:project.name,URL:webUrl}"repo_id=$(az repos show \
--repository "<repo-name>" \
--project "$project" \
--query id --output tsv)az repos delete \
--id "$repo_id" \
--project "$project" \
--yesaz repos list --organization "https://dev.azure.com/${org}" --project "$project" --query "[].{Name:name,ID:id,DefaultBranch:defaultBranch}" -o tableaz repos show --repository <REPO_NAME> --organization "https://dev.azure.com/${org}" --project "$project"az repos show --repository <REPO_NAME> --organization "https://dev.azure.com/${org}" --project "$project" --query remoteUrl -o tsvbase_urlaz repos pr create \
"$@" \
--output table \
--query "{PR:pullRequestId,Status:status,URL:join(\`\`,[\ \`${base_url}\`,\`/pullrequest/\`,to_string(pullRequestId)])}"--title--description--source-branch--target-branch--reviewers--auto-complete--draftaz repos pr list \
--output table \
--query "[].{PR:pullRequestId,Title:title,Creator:createdBy.uniqueName,Created:creationDate,URL:join(\`\`,[\`${base_url}\`,\`/pullrequest/\`,to_string(pullRequestId)])}"--status--creator--reviewer--source-branch--target-branchaz repos pr show \
--id <pr-id> \
--output table \
--query "{PR:pullRequestId,Title:title,Creator:createdBy.uniqueName,Created:creationDate,URL:join(\`\`,[\`${base_url}\`,\`/pullrequest/\`,to_string(pullRequestId)])}"az repos pr update \
--id <pr-id> \
--output table \
--query "{PR:pullRequestId,Status:status,URL:join(\`\`,[\`${base_url}\`,\`/pullrequest/\`,to_string(pullRequestId)])}"--title--description--status--auto-complete--draftaz repos pr update \
--id <pr-id> \
--status completed \
--bypass-policy true \
--output table \
--query "{PR:pullRequestId,Status:status,URL:join(\`\`,[\`${base_url}\`,\`/pullrequest/\`,to_string(pullRequestId)])}"--merge-commit-messageactiveaz repos pr show --id <pr-id>status: completedmergeStatus: succeededaz repos pr update \
--id <pr-id> \
--status abandoned \
--output table \
--query "{PR:pullRequestId,Status:status,URL:join(\`\`,[\`${base_url}\`,\`/pullrequest/\`,to_string(pullRequestId)])}"az repos pr set-vote \
--id <pr-id> \
--vote approveaz repos pr show \
--id <pr-id> \
--output table \
--query "{PR:pullRequestId,Title:title,Creator:createdBy.uniqueName,Created:creationDate,URL:join(\`\`,[\`${base_url}\`,\`/pullrequest/\`,to_string(pullRequestId)])}"approveapprove-with-suggestionswait-for-authorrejectresetcurl -s -u ":${AZURE_DEVOPS_EXT_PAT}" -X POST \
"https://dev.azure.com/${org}/${project}/_apis/git/repositories/<REPO_NAME>/pullRequests/<PR_ID>/threads?api-version=7.0" \
-H "Content-Type: application/json" \
-d '{
"comments": [{"parentCommentId": 0, "content": "Comment text here", "commentType": 1}],
"status": 1
}'curl -s -u ":${AZURE_DEVOPS_EXT_PAT}" \
"https://dev.azure.com/${org}/${project}/_apis/git/repositories/<REPO_NAME>/pullRequests/<PR_ID>/threads?api-version=7.0" \
| jq '.value[] | {id: .id, status: .status, comments: [.comments[] | {author: .author.displayName, content: .content}]}'curl -s -u ":${AZURE_DEVOPS_EXT_PAT}" \
"https://dev.azure.com/${org}/${project}/_apis/git/repositories/<REPO_NAME>/pullRequests/<PR_ID>/threads?api-version=7.0" \
| jq '.value[].comments[] | select(.content | contains("SEARCH_TEXT")) | {author: .author.displayName, content: .content}'az devops service-endpoint list --organization "https://dev.azure.com/${org}" --project "$project" --query "[].{Name:name,Type:type,ID:id,Scheme:authorization.scheme}" -o tableaz devops service-endpoint show --id <ENDPOINT_ID> --organization "https://dev.azure.com/${org}" --project "$project"az devops service-endpoint list --organization "https://dev.azure.com/${org}" --project "$project" --query "[?name=='<NAME>']" -o jsonaz devops service-endpoint delete --id <ENDPOINT_ID> --organization "https://dev.azure.com/${org}" --project "$project" --yescurl -s -u ":${AZURE_DEVOPS_EXT_PAT}" \
"https://dev.azure.com/${org}/${project}/_apis/serviceendpoint/endpoints?api-version=7.1" \
| jq ".value[] | select(.name == \"<NAME>\") | {issuer: .authorization.parameters.workloadIdentityFederationIssuer, subject: .authorization.parameters.workloadIdentityFederationSubject}"SC_ID=$(az devops service-endpoint list --organization "https://dev.azure.com/${org}" --project "$project" --query "[?name=='<NAME>'].id" -o tsv)
curl -s -u ":${AZURE_DEVOPS_EXT_PAT}" -X PATCH \
"https://dev.azure.com/${org}/${project}/_apis/pipelines/pipelinePermissions/endpoint/${SC_ID}?api-version=7.1-preview.1" \
-H "Content-Type: application/json" \
-d '{"allPipelines": {"authorized": true}}'az pipelines pool list --organization "https://dev.azure.com/${org}" --query "[].{Name:name,ID:id,PoolType:poolType,IsHosted:isHosted,Size:size}" -o tableaz pipelines pool list --organization "https://dev.azure.com/${org}" --query "[?contains(name, '<PATTERN>')].{Name:name,ID:id,PoolType:poolType,Size:size}" -o tableaz pipelines pool list --organization "https://dev.azure.com/${org}" --query "[?name=='<POOL_NAME>'].id" -o tsvaz pipelines pool show --organization "https://dev.azure.com/${org}" --pool-id <POOL_ID>curl -s -u ":${AZURE_DEVOPS_EXT_PAT}" -X POST \
"https://dev.azure.com/${org}/_apis/distributedtask/pools?api-version=7.1" \
-H "Content-Type: application/json" \
-d '{"name": "<POOL_NAME>", "poolType": "automation", "isHosted": false, "autoProvision": false}'POOL_ID=$(az pipelines pool list --organization "https://dev.azure.com/${org}" --query "[?name=='<POOL_NAME>'].id" -o tsv)
curl -s -u ":${AZURE_DEVOPS_EXT_PAT}" -X DELETE \
"https://dev.azure.com/${org}/_apis/distributedtask/pools/${POOL_ID}?api-version=7.1"POOL_ID=$(az pipelines pool list --organization "https://dev.azure.com/${org}" --query "[?name=='<POOL_NAME>'].id" -o tsv)
az pipelines agent list --organization "https://dev.azure.com/${org}" --pool-id $POOL_ID --query "[].{Name:name,ID:id,Status:status,Version:version}" -o tablePOOL_ID=$(az pipelines pool list --organization "https://dev.azure.com/${org}" --query "[?name=='<POOL_NAME>'].id" -o tsv)
az pipelines agent list --organization "https://dev.azure.com/${org}" --pool-id $POOL_ID --query "[?status=='online'].{Name:name,ID:id,Version:version}" -o tableaz pipelines agent show --organization "https://dev.azure.com/${org}" --pool-id <POOL_ID> --agent-id <AGENT_ID>POOL_ID=$(az pipelines pool list --organization "https://dev.azure.com/${org}" --query "[?name=='<POOL_NAME>'].id" -o tsv)
az pipelines agent list --organization "https://dev.azure.com/${org}" --pool-id $POOL_ID --query "[?status=='online']" -o tsv | wc -laz pipelines queue list --organization "https://dev.azure.com/${org}" --project "$project" --query "[].{Name:name,QueueID:id,PoolID:pool.id}" -o tableaz pipelines queue list --organization "https://dev.azure.com/${org}" --project "$project" --query "[?contains(name, '<PATTERN>')].{Name:name,QueueID:id,PoolID:pool.id}" -o tablePOOL_ID=$(az pipelines pool list --organization "https://dev.azure.com/${org}" --query "[?name=='<POOL_NAME>'].id" -o tsv)
az pipelines queue list --organization "https://dev.azure.com/${org}" --project "$project" --query "[?pool.id==\`${POOL_ID}\`].id" -o tsvPOOL_ID=$(az pipelines pool list --organization "https://dev.azure.com/${org}" --query "[?name=='<POOL_NAME>'].id" -o tsv)
curl -s -u ":${AZURE_DEVOPS_EXT_PAT}" -X POST \
"https://dev.azure.com/${org}/${project}/_apis/distributedtask/queues?api-version=7.1" \
-H "Content-Type: application/json" \
-d '{"name": "<QUEUE_NAME>", "pool": {"id": '${POOL_ID}'}}'QUEUE_ID=$(az pipelines queue list --organization "https://dev.azure.com/${org}" --project "$project" --query "[?name=='<QUEUE_NAME>'].id" -o tsv)
curl -s -u ":${AZURE_DEVOPS_EXT_PAT}" -X PATCH \
"https://dev.azure.com/${org}/${project}/_apis/pipelines/pipelinePermissions/queue/${QUEUE_ID}?api-version=7.1-preview.1" \
-H "Content-Type: application/json" \
-d '{"allPipelines": {"authorized": true}}'curl -s -u ":${AZURE_DEVOPS_EXT_PAT}" -X PATCH \
"https://dev.azure.com/${org}/${project}/_apis/pipelines/pipelinePermissions/queue/<QUEUE_ID>?api-version=7.1-preview.1" \
-H "Content-Type: application/json" \
-d '{"pipelines": [{"id": <PIPELINE_ID>, "authorized": true}]}'az pipelines list --organization "https://dev.azure.com/${org}" --project "$project" --query "[].{Name:name,ID:id,Folder:folder,QueueStatus:queueStatus}" -o tableaz pipelines list --organization "https://dev.azure.com/${org}" --project "$project" --name "<PATTERN>*" --query "[].{Name:name,ID:id}" -o tableaz pipelines show --organization "https://dev.azure.com/${org}" --project "$project" --name <PIPELINE_NAME>az pipelines list --organization "https://dev.azure.com/${org}" --project "$project" --query "[?name=='<PIPELINE_NAME>'].id" -o tsvaz pipelines create \
--organization "https://dev.azure.com/${org}" \
--project "$project" \
--name <PIPELINE_NAME> \
--repository <REPO_NAME> \
--repository-type tfsgit \
--branch main \
--yml-path azure-pipelines.yml \
--skip-first-runPIPELINE_ID=$(az pipelines list --organization "https://dev.azure.com/${org}" --project "$project" --query "[?name=='<PIPELINE_NAME>'].id" -o tsv)
az pipelines delete --id $PIPELINE_ID --organization "https://dev.azure.com/${org}" --project "$project" --yesaz pipelines run --organization "https://dev.azure.com/${org}" --project "$project" --name <PIPELINE_NAME>RUN_ID=$(az pipelines run --organization "https://dev.azure.com/${org}" --project "$project" --name <PIPELINE_NAME> --query id -o tsv)
echo "Run ID: $RUN_ID"az pipelines run --organization "https://dev.azure.com/${org}" --project "$project" --name <PIPELINE_NAME> --variables "VAR1=value1" "VAR2=value2"az pipelines runs list --organization "https://dev.azure.com/${org}" --project "$project" --top 10 --query "[].{ID:id,Pipeline:definition.name,Status:status,Result:result,StartTime:startTime}" -o tablePIPELINE_ID=$(az pipelines list --organization "https://dev.azure.com/${org}" --project "$project" --query "[?name=='<PIPELINE_NAME>'].id" -o tsv)
az pipelines runs list --organization "https://dev.azure.com/${org}" --project "$project" --pipeline-ids $PIPELINE_ID --query "[].{ID:id,Status:status,Result:result}" -o tableaz pipelines runs show --organization "https://dev.azure.com/${org}" --project "$project" --id <RUN_ID> --query "{Status:status,Result:result}" -o jsonRUN_ID=<RUN_ID>
while true; do
STATUS=$(az pipelines runs show --organization "https://dev.azure.com/${org}" --project "$project" --id $RUN_ID --query status -o tsv)
RESULT=$(az pipelines runs show --organization "https://dev.azure.com/${org}" --project "$project" --id $RUN_ID --query result -o tsv)
echo "Status: $STATUS, Result: ${RESULT:-pending}"
if [ "$STATUS" == "completed" ]; then break; fi
sleep 10
donecurl -s -u ":${AZURE_DEVOPS_EXT_PAT}" \
"https://dev.azure.com/${org}/${project}/_apis/build/builds/<RUN_ID>/timeline?api-version=7.1" \
| jq '.records[] | {name: .name, type: .type, state: .state, result: .result}'curl -s -u ":${AZURE_DEVOPS_EXT_PAT}" \
"https://dev.azure.com/${org}/${project}/_apis/build/builds/<RUN_ID>/logs?api-version=7.1" \
| jq '.value[] | {id: .id, type: .type, lineCount: .lineCount}'curl -s -u ":${AZURE_DEVOPS_EXT_PAT}" \
"https://dev.azure.com/${org}/${project}/_apis/build/builds/<RUN_ID>/logs/<LOG_ID>?api-version=7.1"curl -s -u ":${AZURE_DEVOPS_EXT_PAT}" \
"https://dev.azure.com/${org}/${project}/_apis/build/builds/<RUN_ID>/timeline?api-version=7.1" \
| jq '.records[] | select(.result == "failed") | {name: .name, log: .log.url}'curl -s -u ":${AZURE_DEVOPS_EXT_PAT}" \
"https://dev.azure.com/${org}/${project}/_apis/git/repositories/<REPO_NAME>?api-version=7.0" \
| jq '{id: .id, name: .name, defaultBranch: .defaultBranch}'curl -s -u ":${AZURE_DEVOPS_EXT_PAT}" \
"https://dev.azure.com/${org}/${project}/_apis/git/repositories/<REPO_NAME>/refs?filter=heads/main&api-version=7.0" \
| jq '.value[] | {name: .name, objectId: .objectId}'curl -s -u ":${AZURE_DEVOPS_EXT_PAT}" \
"https://dev.azure.com/${org}/${project}/_apis/git/repositories/<REPO_NAME>/refs?filter=heads/main&api-version=7.0" \
| jq -r '.value[0].objectId'MAIN_SHA=$(curl -s -u ":${AZURE_DEVOPS_EXT_PAT}" \
"https://dev.azure.com/${org}/${project}/_apis/git/repositories/<REPO_NAME>/refs?filter=heads/main&api-version=7.0" \
| jq -r '.value[0].objectId')
curl -s -u ":${AZURE_DEVOPS_EXT_PAT}" -X POST \
"https://dev.azure.com/${org}/${project}/_apis/git/repositories/<REPO_NAME>/refs?api-version=7.0" \
-H "Content-Type: application/json" \
-d '[{"name": "refs/heads/<BRANCH_NAME>", "oldObjectId": "0000000000000000000000000000000000000000", "newObjectId": "'${MAIN_SHA}'"}]'curl -s -u ":${AZURE_DEVOPS_EXT_PAT}" -X POST \
"https://dev.azure.com/${org}/${project}/_apis/git/repositories/<REPO_NAME>/refs?api-version=7.0" \
-H "Content-Type: application/json" \
-d '[{"name": "refs/heads/<BRANCH_NAME>", "oldObjectId": "<LAST_COMMIT_SHA>", "newObjectId": "0000000000000000000000000000000000000000"}]'curl -s -u ":${AZURE_DEVOPS_EXT_PAT}" -X POST \
"https://dev.azure.com/${org}/${project}/_apis/git/repositories/<REPO_NAME>/pushes?api-version=7.0" \
-H "Content-Type: application/json" \
-d '{
"refUpdates": [{"name": "refs/heads/<BRANCH_NAME>", "oldObjectId": "<BASE_COMMIT_SHA>"}],
"commits": [{
"comment": "Commit message here",
"changes": [
{
"changeType": "edit",
"item": {"path": "/path/to/file"},
"newContent": {"content": "file content here", "contentType": "rawtext"}
}
]
}]
}'curl -s -u ":${AZURE_DEVOPS_EXT_PAT}" -X POST \
"https://dev.azure.com/${org}/${project}/_apis/git/repositories/<REPO_NAME>/pushes?api-version=7.0" \
-H "Content-Type: application/json" \
-d '{
"refUpdates": [{"name": "refs/heads/main", "oldObjectId": "0000000000000000000000000000000000000000"}],
"commits": [{
"comment": "Initial commit",
"changes": [
{
"changeType": "add",
"item": {"path": "/README.md"},
"newContent": {"content": "# Repo Title", "contentType": "rawtext"}
}
]
}]
}'CONTENT_B64=$(echo -n "file contents here" | base64)
curl -s -u ":${AZURE_DEVOPS_EXT_PAT}" -X POST \
"https://dev.azure.com/${org}/${project}/_apis/git/repositories/<REPO_NAME>/pushes?api-version=7.0" \
-H "Content-Type: application/json" \
-d '{
"refUpdates": [{"name": "refs/heads/<BRANCH>", "oldObjectId": "<SHA>"}],
"commits": [{
"comment": "Add file",
"changes": [{
"changeType": "add",
"item": {"path": "/file.txt"},
"newContent": {"content": "'${CONTENT_B64}'", "contentType": "base64encoded"}
}]
}]
}'az repos prcurl -s -u ":${AZURE_DEVOPS_EXT_PAT}" -X POST \
"https://dev.azure.com/${org}/${project}/_apis/git/repositories/<REPO_NAME>/pullrequests?api-version=7.0" \
-H "Content-Type: application/json" \
-d '{
"sourceRefName": "refs/heads/<SOURCE_BRANCH>",
"targetRefName": "refs/heads/main",
"title": "PR Title",
"description": "PR description"
}' | jq '{pullRequestId: .pullRequestId, status: .status}'curl -s -u ":${AZURE_DEVOPS_EXT_PAT}" \
"https://dev.azure.com/${org}/${project}/_apis/git/repositories/<REPO_NAME>/pullRequests/<PR_ID>?api-version=7.0" \
| jq '{id: .pullRequestId, title: .title, status: .status, sourceRefName: .sourceRefName}'curl -s -u ":${AZURE_DEVOPS_EXT_PAT}" \
"https://dev.azure.com/${org}/${project}/_apis/git/repositories/<REPO_NAME>/pullrequests?api-version=7.0" \
| jq '.value[] | {id: .pullRequestId, title: .title, status: .status}'curl -s -u ":${AZURE_DEVOPS_EXT_PAT}" -X PATCH \
"https://dev.azure.com/${org}/${project}/_apis/git/repositories/<REPO_NAME>/pullRequests/<PR_ID>?api-version=7.0" \
-H "Content-Type: application/json" \
-d '{"status": "abandoned"}'curl -s -u ":${AZURE_DEVOPS_EXT_PAT}" -X PATCH \
"https://dev.azure.com/${org}/${project}/_apis/git/repositories/<REPO_NAME>/pullRequests/<PR_ID>?api-version=7.0" \
-H "Content-Type: application/json" \
-d '{
"status": "completed",
"lastMergeSourceCommit": {"commitId": "<LAST_COMMIT_SHA>"},
"completionOptions": {"deleteSourceBranch": true, "mergeStrategy": "squash"}
}'almsearch.dev.azure.comdev.azure.comcurl -s -u ":${AZURE_DEVOPS_EXT_PAT}" -X POST \
"https://almsearch.dev.azure.com/${org}/${project}/_apis/search/codesearchresults?api-version=7.1" \
-H "Content-Type: application/json" \
-d '{"searchText":"<TEXT>","$top":25}' \
| jq '{count: .count, results: [.results[] | {repo: .repository.name, path: .path}]}'curl -s -u ":${AZURE_DEVOPS_EXT_PAT}" -X POST \
"https://almsearch.dev.azure.com/${org}/_apis/search/codesearchresults?api-version=7.1" \
-H "Content-Type: application/json" \
-d '{
"searchText":"<TEXT>",
"filters":{"Project":["<PROJECT>"],"Repository":["<REPO>"],"Branch":["main"],"Path":["/src"]},
"$top":25
}' \
| jq '.results[] | {project: .project.name, repo: .repository.name, path: .path}'ProjectRepositoryBranchPathCodeElement["def","class"]searchTextext:go quiver-boltfile:Makefile quiver-boltdef:MyFunction"exact phrase"foo AND barfoo OR barfoo NOT barcurl -s -u ":${AZURE_DEVOPS_EXT_PAT}" \
"https://dev.azure.com/${org}/_apis/hooks/subscriptions?api-version=7.0" \
| jq '.value[] | {id: .id, eventType: .eventType, consumerActionId: .consumerActionId, publisherInputs: .publisherInputs}'curl -s -u ":${AZURE_DEVOPS_EXT_PAT}" -X POST \
"https://dev.azure.com/${org}/_apis/hooks/subscriptions?api-version=7.0" \
-H "Content-Type: application/json" \
-d '{
"publisherId": "tfs",
"eventType": "git.pullrequest.created",
"resourceVersion": "1.0",
"consumerId": "webHooks",
"consumerActionId": "httpRequest",
"publisherInputs": {
"projectId": "<PROJECT_ID>",
"repository": "<REPO_ID>"
},
"consumerInputs": {
"url": "<WEBHOOK_URL>"
}
}'curl -s -u ":${AZURE_DEVOPS_EXT_PAT}" -X DELETE \
"https://dev.azure.com/${org}/_apis/hooks/subscriptions/<SUBSCRIPTION_ID>?api-version=7.0"echo "=== Service Connections ==="
az devops service-endpoint list --organization "https://dev.azure.com/${org}" --project "$project" --query "[].{Name:name,Type:type}" -o table
echo ""
echo "=== Agent Pools ==="
az pipelines pool list --organization "https://dev.azure.com/${org}" --query "[].{Name:name,Size:size,IsHosted:isHosted}" -o table
echo ""
echo "=== Queues ==="
az pipelines queue list --organization "https://dev.azure.com/${org}" --project "$project" --query "[].{Name:name,QueueID:id}" -o tablePOOL_ID=$(az pipelines pool list --organization "https://dev.azure.com/${org}" --query "[?name=='<POOL_NAME>'].id" -o tsv)
if [ -n "$POOL_ID" ]; then
az pipelines agent list --organization "https://dev.azure.com/${org}" --pool-id $POOL_ID --query "[].{Name:name,Status:status}" -o table
fiPOOL_ID=$(az pipelines pool list --organization "https://dev.azure.com/${org}" --query "[?name=='<POOL_NAME>'].id" -o tsv)
MAX_WAIT=300
ELAPSED=0
while [ $ELAPSED -lt $MAX_WAIT ]; do
ONLINE=$(az pipelines agent list --organization "https://dev.azure.com/${org}" --pool-id $POOL_ID --query "[?status=='online']" -o tsv | wc -l)
if [ "$ONLINE" -gt 0 ]; then
echo "Found $ONLINE online agent(s)"
break
fi
echo "Waiting for agents... ($ELAPSED/${MAX_WAIT}s)"
sleep 10
ELAPSED=$((ELAPSED + 10))
done