SuperAPI AI Directory

ado-operation

Deployment & operations

View repository

Updated 10-16 02:33

About this skill

Azure DevOps Operations

Azure CLI (az devops) as the core, a skill for operating Azure DevOps. For operations without a dedicated command, az devops invoke (REST API wrapper) to fill in the gaps.

IMPORTANT: Preventing Windows Japanese mojibake

Azure CLI (MSI version) launches its built-in Python in -I (isolated mode), so PYTHONUTF8=1 や PYTHONIOENCODING environment variables such asare disabled. Output is always cp932 (Shift-JIS), soat the end of every az command 2>&1 | iconv -f cp932 -t utf-8 append

# NG: 日本語が文字化けする
az boards work-item show --id 123 --output table

# OK: iconv で UTF-8 に変換
az boards work-item show --id 123 --output table 2>&1 | iconv -f cp932 -t utf-8

This rule applies to all commands in this skill.

Command System

Layer Command Purpose
Work Items az boards work-item / az boards query CRUD, WIQL queries
Pull Requests az repos pr Create, review, vote, merge
Repositories az repos / az repos ref Repository management, branch management
Pipelines az pipelines / az pipelines build Run, monitor, variable management
REST API supplementation az devops invoke All operations not covered above

az devops invoke operations that require

The following have no dedicated command, so use az devops invoke to handle them:

  • PR comments/threads -- get, add, inline comments, status updates
  • Build timeline -- details of stages, jobs, and tasks and identifying failure points
  • Test results -- test run results and details of failed tests
  • Attachments -- upload and link attachments to Work Items
  • Git diff -- diff between commits and list of changed files in a PR
  • Notifications -- subscription management

For details, see references/rest-api.md .

MCP (optional)

Azure DevOps MCP Server (@azure-devops/mcp) is already configured, MCP tools are also available. Functionally equivalent to the CLI, but may be more efficient because it can retrieve structured data directly.

MCP setup: ~/.claude/settings.json の mcpServers add to:

"azure-devops": {
  "type": "stdio",
  "command": "npx",
  "args": ["-y", "@azure-devops/mcp", "{ORG_NAME}"]
}

Prerequisites

# Login check
az account show 2>&1 | iconv -f cp932 -t utf-8

# DevOps extension check
az extension show --name azure-devops 2>&1 | iconv -f cp932 -t utf-8

# Organization default setting (recommend)
az devops configure --defaults organization=https://dev.azure.com/{ORG}
az devops configure --defaults project={PROJECT}

Core Workflow

1. Work Items

For details, see references/work-items.md .

# 作成
az boards work-item create --type "Task" --title "タスク名" \
  --assigned-to "user@example.com" --description "詳細" 2>&1 | iconv -f cp932 -t utf-8

# 表示
az boards work-item show --id {ID} --output table 2>&1 | iconv -f cp932 -t utf-8

# 更新
az boards work-item update --id {ID} --state "Active" \
  --assigned-to "user@example.com" 2>&1 | iconv -f cp932 -t utf-8

# WIQL クエリ
az boards query --wiql "SELECT [System.Id], [System.Title], [System.State] \
  FROM WorkItems WHERE [System.AssignedTo] = @Me \
  AND [System.State] <> 'Closed' \
  ORDER BY [System.ChangedDate] DESC" --output table 2>&1 | iconv -f cp932 -t utf-8

2. Pull Requests

For details, see references/pull-requests.md .

# PR 作成
az repos pr create --source-branch "feature/xxx" --target-branch "main" \
  --title "タイトル" --description "説明" 2>&1 | iconv -f cp932 -t utf-8

# PR 一覧
az repos pr list --status active --output table 2>&1 | iconv -f cp932 -t utf-8

# レビュー投票 (approve=10, approve-with-suggestions=5, wait-for-author=-5, reject=-10)
az repos pr set-vote --id {PR_ID} --vote approve 2>&1 | iconv -f cp932 -t utf-8

# PR コメント取得 (az devops invoke)
# NOTE: --resource には REST API パス名ではなく CLI 内部の resource 名を使う
az devops invoke --area git --resource pullRequestThreads \
  --route-parameters project={PROJECT} repositoryId={REPO_ID} pullRequestId={PR_ID} \
  --http-method GET --api-version "7.1" 2>&1 | iconv -f cp932 -t utf-8

3. Pipelines

For details, see references/pipelines.md .

# パイプライン一覧
az pipelines list --output table 2>&1 | iconv -f cp932 -t utf-8

# 実行
az pipelines run --name "pipeline-name" --branch "main" 2>&1 | iconv -f cp932 -t utf-8

# ビルド状態確認
az pipelines build show --id {BUILD_ID} --output table 2>&1 | iconv -f cp932 -t utf-8

# ビルドタイムライン (az devops invoke)
az devops invoke --area build --resource timeline \
  --route-parameters project={PROJECT} buildId={BUILD_ID} \
  --api-version "7.1" 2>&1 | iconv -f cp932 -t utf-8

4. Repository Operations

# リポジトリ一覧
az repos list --output table 2>&1 | iconv -f cp932 -t utf-8

# ブランチ一覧
az repos ref list --repository {REPO} --filter heads/ --output table 2>&1 | iconv -f cp932 -t utf-8

az devops invoke Quick Reference

Important: --resource specify not the path segment name of the REST API URL, but the resource name registered internally in the CLI (usually camelCase). If you specify an incorrect resource name, --resource and --api-version combination is not correct ismisleading erroroccurs (the cause is the resource name, not api-version).

# 基本構文
az devops invoke --area {area} --resource {resource} \
  --route-parameters {key=value ...} \
  --http-method {GET|POST|PATCH|DELETE} \
  --in-file {body.json} \
  --api-version "7.1" 2>&1 | iconv -f cp932 -t utf-8

# 利用可能な area/resource を確認(resource名が不明な場合は必ず実行)
az devops invoke --query "[?area=='{area}'].{Area:area, Resource:resourceName}" \
  --output table 2>&1 | iconv -f cp932 -t utf-8

Commonly used resource name mapping

Purpose area resource (correct name)
Get/add PR threads git pullRequestThreads
Comments in PR threads git pullRequestThreadComments
PR iterations git pullRequestIterations
PR iteration changes git pullRequestIterationChanges
Diff between commits git commitDiffs
Build timeline build Timeline
Build logs build logs

Output Format Tips

  • --output table in a human-readable table format
  • --output json for programmatic processing
  • --query with JMESPath filtering (example: --query "[].{ID:id, Title:fields.\"System.Title\"}")

Error Handling

Error Resolution
az devops: command not found az extension add --name azure-devops
TF401019: unauthorized az devops login to reconfigure PAT
TF200016: project not found --project parameter check,az devops configure --defaults project=XXX
az devops invoke area unknown az devops invoke --query "[].{Area:area}" to confirm
--resource and --api-version combination is not correct resource name is incorrect(not an api-version issue). Refer to the mapping table above or az devops invoke --query "[?area=='{area}'].resourceName" to confirm
Japanese text is garbled 2>&1 | iconv -f cp932 -t utf-8 append to the end of the pipe