azure-devops-cli

majiayu000's avatarfrom majiayu000

Generate Azure DevOps CLI commands for automation and scripting. Use when automating Azure DevOps operations via CLI.

⭐0stars🔀0forks📁View on GitHub🕐Updated Jan 5, 2026

When & Why to Use This Skill

This Claude skill empowers developers and DevOps engineers to automate Azure DevOps operations by generating accurate CLI commands and scripts. It covers the full lifecycle of software delivery, including pipeline management, repository actions, work item tracking, and artifact handling, significantly reducing manual overhead and improving workflow efficiency.

Use Cases

  • Automating CI/CD workflows: Quickly generate commands to run, cancel, or monitor Azure Pipelines and download build logs.
  • Repository Management: Streamline Git operations such as creating repositories, managing pull requests, and adding reviewers through the CLI.
  • Project Tracking Automation: Efficiently create, update, and query work items in Azure Boards to maintain project momentum.
  • Artifact Lifecycle Management: Simplify the process of publishing and downloading universal packages within Azure Artifacts feeds.
  • Custom DevOps Scripting: Develop complex scripts for batch operations, such as auto-approving Dependabot PRs or retrying failed builds.
nameazure-devops-cli
descriptionGenerate Azure DevOps CLI commands for automation and scripting. Use when automating Azure DevOps operations via CLI.

Azure DevOps CLI Skill

Azure DevOps CLIの使用を支援するスキルです。

主な機能

  • CLI コマンド生成: よく使うコマンド
  • 認証設定: PAT、OAuth
  • パイプライン操作: 実行、キャンセル
  • リポジトリ操作: クローン、PR作成
  • ワークアイテム: 作成、更新、クエリ

セットアップ

# Azure DevOps拡張インストール
az extension add --name azure-devops

# デフォルト組織・プロジェクト設定
az devops configure --defaults organization=https://dev.azure.com/myorg project=MyProject

# PAT認証
export AZURE_DEVOPS_EXT_PAT=your-personal-access-token

パイプライン操作

# パイプライン一覧
az pipelines list --output table

# パイプライン実行
az pipelines run --name "MyPipeline" --branch main

# ビルド一覧
az pipelines build list --status inProgress --output table

# ビルド詳細
az pipelines build show --id 123

# ビルドキャンセル
az pipelines build cancel --id 123

# ビルドログ
az pipelines runs artifact download --artifact-name logs --path ./logs --run-id 123

リポジトリ操作

# リポジトリ一覧
az repos list --output table

# リポジトリ作成
az repos create --name "new-repo"

# PR作成
az repos pr create \
  --source-branch feature/new-feature \
  --target-branch main \
  --title "Add new feature" \
  --description "Implements feature XYZ"

# PR一覧
az repos pr list --status active

# PRレビュー
az repos pr reviewers add --id 123 --reviewers user@example.com

# PRマージ
az repos pr update --id 123 --status completed

ワークアイテム操作

# ワークアイテム作成
az boards work-item create \
  --title "Implement login feature" \
  --type "User Story" \
  --assigned-to user@example.com \
  --fields "System.Tags=authentication;security"

# ワークアイテム更新
az boards work-item update --id 123 --state Active

# クエリ実行
az boards query --wiql "SELECT [System.Id], [System.Title] FROM WorkItems WHERE [System.WorkItemType] = 'Bug'"

# 関連
付け
az boards work-item relation add --id 123 --relation-type "Related" --target-id 456

アーティファクト操作

# Feedリスト
az artifacts universal list --feed MyFeed

# パッケージアップロード
az artifacts universal publish \
  --organization https://dev.azure.com/myorg \
  --feed MyFeed \
  --name my-package \
  --version 1.0.0 \
  --description "Package description" \
  --path ./dist

# パッケージダウンロード
az artifacts universal download \
  --organization https://dev.azure.com/myorg \
  --feed MyFeed \
  --name my-package \
  --version 1.0.0 \
  --path ./downloads

便利なスクリプト

失敗したビルドを再実行

#!/bin/bash
FAILED_BUILDS=$(az pipelines build list --status failed --query "[].id" -o tsv)

for BUILD_ID in $FAILED_BUILDS; do
  echo "Retrying build $BUILD_ID"
  az pipelines build queue --definition-id $(az pipelines build show --id $BUILD_ID --query "definition.id" -o tsv)
done

PRの自動承認(条件付き)

#!/bin/bash
PRS=$(az repos pr list --status active --query "[?sourceRefName=='refs/heads/dependabot/*'].pullRequestId" -o tsv)

for PR_ID in $PRS; do
  echo "Auto-approving PR $PR_ID"
  az repos pr update --id $PR_ID --vote approve
done

バージョン情報

  • Version: 1.0.0