| name | azure-devops |
| description | Azure DevOps integration covering pipelines, boards, repos, artifacts, and work item management via Azure CLI and REST API |
| version | 1.0.0 |
| category | devops |
| tools | ["Bash","WebFetch","Read","Write"] |
| source | builtin |
| trust_score | 100 |
| provenance_sha | b474ce94dcd3e04a |
Azure DevOps Skill
Overview
This skill provides comprehensive integration with Azure DevOps including Pipelines, Boards, Repos, Artifacts, and Test Plans. Use it for CI/CD automation, work item tracking, and repository management.
Prerequisites
az extension add --name azure-devops
az --version
az devops --version
Authentication
Interactive Login
az login
az devops configure --defaults organization=https://dev.azure.com/YOUR_ORG project=YOUR_PROJECT
az devops configure --list
Service Principal / PAT Authentication
export AZURE_DEVOPS_EXT_PAT="your-personal-access-token"
az login --service-principal \
--username "$AZURE_CLIENT_ID" \
--password "$AZURE_CLIENT_SECRET" \
--tenant "$AZURE_TENANT_ID"
PAT Scopes Required
| Scope | Operations |
|---|
vso.work_write | Create/update work items |
vso.build_execute | Queue and manage pipelines |
vso.code_write | Read/write repositories |
vso.packaging_write | Publish artifacts |
vso.release_execute | Manage release pipelines |
Pipelines
Pipeline Management
az pipelines list --output table
az pipelines run --name "CI Pipeline" --branch main
az pipelines run \
--name "Deploy Pipeline" \
--branch main \
--parameters environment=staging version=1.2.3
az pipelines runs show --id RUN_ID
az pipelines runs list --pipeline-name "CI Pipeline" --status completed --top 10 --output table
az pipelines runs logs download --run-id RUN_ID --output logs/
Pipeline Variables
az pipelines variable list --pipeline-name "CI Pipeline"
az pipelines variable create \
--name DEPLOY_TARGET \
--value production \
--pipeline-name "CI Pipeline"
az pipelines variable create \
--name API_SECRET \
--value "secret-value" \
--secret true \
--pipeline-name "CI Pipeline"
az pipelines variable delete --name DEPLOY_TARGET --pipeline-name "CI Pipeline"
Pipeline YAML Reference
trigger:
branches:
include:
- main
- feature/*
paths:
exclude:
- docs/*
pr:
branches:
include:
- main
pool:
vmImage: 'ubuntu-latest'
variables:
buildConfiguration: 'Release'
NODE_VERSION: '20.x'
stages:
- stage: Build
displayName: 'Build and Test'
jobs:
- job: BuildJob
steps:
- task: NodeTool@0
inputs:
versionSpec: $(NODE_VERSION)
- script: |
npm ci
npm run build
npm test
displayName: 'Install, Build, Test'
- task: PublishTestResults@2
inputs:
testResultsFormat: 'JUnit'
testResultsFiles: '**/test-results.xml'
- task: PublishBuildArtifacts@1
inputs:
pathToPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: 'drop'
- stage: Deploy
displayName: 'Deploy to Production'
dependsOn: Build
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
jobs:
- deployment: DeployJob
environment: 'production'
strategy:
runOnce:
deploy:
steps:
- script: echo "Deploying to production"
Release Pipelines
az pipelines release definition list --output table
az pipelines release create \
--definition-name "Release Pipeline" \
--artifact-metadata-list "build=CI Pipeline:1.2.3"
az pipelines release list --definition-name "Release Pipeline" --output table
Boards — Work Items
Work Item Operations
az boards work-item create \
--type "User Story" \
--title "As a user, I can reset my password" \
--description "Implement password reset flow" \
--assigned-to "user@example.com" \
--area "MyProject\Frontend"
az boards work-item show --id 123
az boards work-item update \
--id 123 \
--state "Active" \
--assigned-to "developer@example.com"
az boards work-item delete --id 123 --yes
Work Item Queries
az boards query \
--wiql "SELECT [System.Id], [System.Title], [System.State] FROM WorkItems WHERE [System.TeamProject] = 'MyProject' AND [System.State] = 'Active' ORDER BY [System.CreatedDate] DESC"
az boards query \
--wiql "SELECT * FROM WorkItems WHERE [System.IterationPath] = 'MyProject\\Sprint 10' AND [System.WorkItemType] = 'Task'"
Work Item Relations
az boards work-item relation add \
--id 100 \
--relation-type "Child" \
--target-id 101
az boards work-item relation list-type
Repos
Repository Management
az repos list --output table
az repos show --repository MyRepo
az repos create --name "new-service"
Pull Requests
az repos pr list --status active --output table
az repos pr create \
--title "Feature: Add authentication" \
--description "Implements JWT auth with refresh tokens" \
--source-branch feature/auth \
--target-branch main \
--reviewers "reviewer@example.com" \
--work-items 123 456
az repos pr show --id PR_ID
az repos pr set-vote --id PR_ID --vote approve
az repos pr update \
--id PR_ID \
--status completed \
--merge-strategy merge
az repos pr policy list --id PR_ID
Branch Policies
az repos policy list --branch main --output table
az repos policy required-reviewer create \
--branch main \
--is-blocking true \
--is-enabled true \
--minimum-approver-count 2 \
--repository-id REPO_ID
az repos policy build create \
--branch main \
--is-blocking true \
--is-enabled true \
--build-definition-id BUILD_DEF_ID \
--repository-id REPO_ID
Git Operations via REST API
BASE_URL="https://dev.azure.com/$ORG/$PROJECT/_apis"
curl -u ":$AZURE_DEVOPS_EXT_PAT" \
"$BASE_URL/git/repositories/REPO_ID/commits?api-version=7.1&searchCriteria.itemVersion.version=main&searchCriteria.\$top=10"
curl -u ":$AZURE_DEVOPS_EXT_PAT" \
"$BASE_URL/git/repositories/REPO_ID/items?path=/src/app.ts&api-version=7.1"
Artifacts
Feed Management
az artifacts feed list --output table
az artifacts feed create --name my-packages
az artifacts feed show --name my-packages
npm Package Publishing
az artifacts feeds authenticate --feed my-packages
FEED_URL="https://pkgs.dev.azure.com/ORG/_packaging/my-packages/npm/registry/"
cat > .npmrc << EOF
registry=${FEED_URL}
always-auth=true
; ${FEED_URL}:username=PAT
; ${FEED_URL}:_password=$(echo -n "$AZURE_DEVOPS_EXT_PAT" | base64)
EOF
npm publish
NuGet Package Publishing
az artifacts feeds show --name my-packages --query nugetInfo.url --output tsv
dotnet nuget add source \
"https://pkgs.dev.azure.com/ORG/_packaging/my-packages/nuget/v3/index.json" \
--name azure-artifacts \
--username PAT \
--password "$AZURE_DEVOPS_EXT_PAT"
dotnet nuget push "*.nupkg" --source azure-artifacts
MCP Server Configuration
Setup Azure DevOps MCP Server
{
"mcpServers": {
"azure-devops": {
"command": "npx",
"args": ["-y", "@tiberriver256/mcp-server-azure-devops"],
"env": {
"AZURE_DEVOPS_ORG_URL": "https://dev.azure.com/YOUR_ORG",
"AZURE_DEVOPS_PAT": "your-personal-access-token",
"AZURE_DEVOPS_DEFAULT_PROJECT": "YOUR_PROJECT"
}
}
}
}
Add to .claude/settings.json under mcpServers for agent-studio integration.
Available MCP Tools (after setup)
azure_devops_get_work_item — Retrieve work item by ID
azure_devops_create_work_item — Create new work item
azure_devops_update_work_item — Update work item fields
azure_devops_list_work_items — Query work items
azure_devops_get_pipeline — Get pipeline definition
azure_devops_run_pipeline — Trigger pipeline run
azure_devops_get_pipeline_run — Get run status and logs
azure_devops_list_repos — List repositories
azure_devops_create_pr — Create pull request
azure_devops_get_pr — Get PR details
REST API Integration
Direct API Calls
ado_api() {
local method="$1"
local path="$2"
local data="$3"
local org="${AZURE_DEVOPS_ORG:-your-org}"
local project="${AZURE_DEVOPS_PROJECT:-your-project}"
local url="https://dev.azure.com/$org/$project/_apis/$path"
curl -s \
-u ":$AZURE_DEVOPS_EXT_PAT" \
-X "$method" \
-H "Content-Type: application/json" \
${data:+-d "$data"} \
"$url"
}
ado_api GET "projects?api-version=7.1" | jq '.value[] | {name, state}'
ado_api POST "build/builds?api-version=7.1" '{
"definition": {"id": 1},
"sourceBranch": "refs/heads/main"
}' | jq '{id, status, buildNumber}'
Cross-Service Workflows
CI/CD with Work Item Tracking
update_work_items_on_build_start() {
local build_source_branch="$1"
local item_ids
item_ids=$(echo "$build_source_branch" | grep -oP 'AB#\K[0-9]+')
for item_id in $item_ids; do
az boards work-item update \
--id "$item_id" \
--state "Active" \
--discussion "Build started for $(git log -1 --format='%H %s')"
echo "Updated work item $item_id to Active"
done
}
close_work_items_on_deploy() {
local work_item_ids=("$@")
for item_id in "${work_item_ids[@]}"; do
az boards work-item update \
--id "$item_id" \
--state "Closed" \
--discussion "Deployed to production successfully"
done
}
Automated Sprint Reports
generate_sprint_report() {
local iteration="${1:-@CurrentIteration}"
echo "# Sprint Report: $(date +%Y-%m-%d)"
echo ""
echo "## Completed"
az boards query \
--wiql "SELECT [System.Id], [System.Title] FROM WorkItems WHERE [System.IterationPath] = '$iteration' AND [System.State] = 'Closed'" \
--query "workItems[].fields.[\"System.Title\"]" \
--output tsv | while read -r title; do
echo "- $title"
done
echo ""
echo "## In Progress"
az boards query \
--wiql "SELECT [System.Id], [System.Title] FROM WorkItems WHERE [System.IterationPath] = '$iteration' AND [System.State] = 'Active'" \
--query "workItems[].fields.[\"System.Title\"]" \
--output tsv | while read -r title; do
echo "- $title"
done
}
Environment Variables Reference
| Variable | Description | Required |
|---|
AZURE_DEVOPS_EXT_PAT | Personal Access Token | Yes |
AZURE_DEVOPS_ORG | Organization name | Yes |
AZURE_DEVOPS_PROJECT | Default project | Recommended |
AZURE_CLIENT_ID | Service principal app ID | For SP auth |
AZURE_CLIENT_SECRET | Service principal secret | For SP auth |
AZURE_TENANT_ID | Azure AD tenant ID | For SP auth |
Error Handling and Troubleshooting
az account show
az devops configure --list
az pipelines run --name "CI" --debug 2>&1 | grep -A3 "Request"
Best Practices
- Use Service Connections — Connect Azure DevOps to external services (AWS, Docker Hub) via service connections, not raw credentials in pipelines.
- Environment protection rules — Gate production deployments with required approvals in Environments.
- YAML pipeline templates — Extract reusable pipeline logic to templates in a shared repository.
- Variable groups — Store environment-specific variables in Library variable groups, link to Azure Key Vault for secrets.
- Branch policies — Enforce code quality with required build validation and reviewer policies on protected branches.
- Agent pools — Use self-hosted agents for private network access, Microsoft-hosted for clean environments.
- PAT rotation — Rotate PATs every 90 days; use service principals for long-lived automation.
- Work item templates — Define templates for common work item types to ensure consistent metadata capture.
Related Skills
devops — General DevOps patterns and CI/CD workflows
atlassian-integration — Jira/Confluence alternative for project management
github-ops — GitHub alternative for source control and CI/CD
terraform-infra — Infrastructure as Code for Azure resources