Azure devops

From OpenHands/extensions · View interactive version

Azure devops is an AI agent skill from the GitHub repository OpenHands/extensions. Interact with Azure DevOps repositories, pull requests, and APIs using the AZURE_DEVOPS_TOKEN environment variable. Use when working with code hosted on Azure DevOps or managing Azure DevOps resources.

How to use this skill

Skill file

Connection selection

Use authenticated Azure DevOps MCP tools first when they are available in the agent's environment. Detect this by tool availability, without depending on a particular MCP server name. Use the token and direct API instructions below only when Azure DevOps MCP tools are unavailable or when raw API or curl access is explicitly needed.

You have access to an environment variable, AZURE_DEVOPS_TOKEN, which allows you to interact with

the Azure DevOps API.

<IMPORTANT>

You can use curl with the AZURE_DEVOPS_TOKEN to interact with Azure DevOps's API.

ALWAYS use the Azure DevOps API for operations instead of a web browser.

</IMPORTANT>

Git

Use plain git clone, git fetch, git pull and git push. OpenHands sets up git credentials for each Azure DevOps organization the user belongs to, so these commands work for any repository in those organizations, not only the one that was opened. Run them with GIT_TERMINAL_PROMPT=0 so git fails at once instead of waiting at a username or password prompt.

A repository written as ORG/PROJECT/REPO is cloned from https://dev.azure.com/ORG/PROJECT/_git/REPO:

GIT_TERMINAL_PROMPT=0 git clone https://dev.azure.com/ORG/PROJECT/_git/REPO

Do not put AZURE_DEVOPS_TOKEN in a remote URL or pass it to git as an option: a token saved in .git/config stays on disk and stops working when it expires. If git fails because it needs a username or password, credentials are not set up for that organization; tell the user instead of embedding the token.

Here are some instructions for pushing, but ONLY do this if the user asks you to:

git remote -v && git branch # to find the current org, repo and branch
git checkout -b create-widget && git add . && git commit -m "Create widget" && GIT_TERMINAL_PROMPT=0 git push -u origin create-widget

On Windows PowerShell, set $env:GIT_TERMINAL_PROMPT = "0" and run those git commands as separate commands if && is not supported by the installed shell.

Azure DevOps API Usage

AZURE_DEVOPS_TOKEN is either a Personal Access Token (PAT) or, for users who sign in with Microsoft Entra ID, an Entra access token. Basic authentication works with both: leave the username empty and use the token as the password. An Entra access token can also be sent as Authorization: Bearer $AZURE_DEVOPS_TOKEN.

Here's how to authenticate with curl:

# Base64-encode ":<token>" on one line (Entra tokens are long enough to wrap)
AUTH=$(echo -n ":$AZURE_DEVOPS_TOKEN" | base64 | tr -d '\n')

# Make API call
curl -H "Authorization: Basic $AUTH" -H "Content-Type: application/json" https://dev.azure.com/{organization}/{project}/_apis/git/repositories?api-version=7.1

PowerShell equivalent for the Basic header:

$auth = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(":$env:AZURE_DEVOPS_TOKEN"))
Invoke-RestMethod `
  -Headers @{ Authorization = "Basic $auth"; "Content-Type" = "application/json" } `
  -Uri "https://dev.azure.com/{organization}/{project}/_apis/git/repositories?api-version=7.1"

Common API endpoints:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.