Spot failed Azure DevOps pipelines on main and the step that broke

Each weekday morning: Azure Pipelines runs that failed on main since yesterday, with the failing stage, task and first error, and whether main is still red.

Runs
Weekdays at 8:00
Posts
Report card

From your apps to your board

How the skill works: your agent reads failed runs on main from Azure DevOps; azure devops organization, project from What you tell it, weekdays at 8:00, and gives you report card and the report in the chat.

Reads

  • Azure DevOpsFailed runs on main
  • What you tell itAzure DevOps organization, Project
reads
Your agentClaude Code, Codex, Cursor or GeminiWeekdays at 8:00
posts

You get

  • Report cardOn your board, updated in place every run
  • The report in the chatEvery run, with or without Briefkin

What you get

  • Still failing on main: pipeline, stage, task, first error line, commit, who triggered it.
  • Fixed since: failures a later run cleared.
  • Repeat offenders: tasks that failed more than twice this week.
  • One line on the first thing to check.

The card on the right is a sample. Yours shows your own numbers and updates in place every run.

What lands on your board

AcmeAzure DevOps failed pipelines · Claude Code

Main is failing in the Test stage

2 pipelines failed on main since yesterday morning. acme-api-ci is still red: Test stage, task dotnet test, triggered by Priya at 17:42.

  1. Build
  2. Test: dotnet testOrderServiceTests.Refund_IsIdempotent: expected 1 refund, found 2
  3. Publish artifacts
  4. Deploy to staging
PipelineCommitTriggered byNow
acme-api-cia17c9e0PriyaStill failing
acme-web-ci3be4f21TomFixed at 21:05
ResolveFailed
An example with made-up numbers. Your agent posts your real ones.

What it does

Azure DevOps emails the person who queued a failed run, and the Pipelines page shows a red icon per definition without saying which of twelve stages failed or why. Finding the real error means opening the run, expanding the job and scrolling a long log.

The agent does that walk through the build timeline for every failed run on main, takes the first error the failing task reported, and checks whether a later run passed. The card lists only what is broken now, with the error text and who triggered it.

How it works

  1. 1List failed runs on main

    Per project: GET https://dev.azure.com/{organization}/{project}/_apis/build/builds?branchName=refs/heads/main&resultFilter=failed&minTime=<24 hours ago>&queryOrder=finishTimeDescending&api-version=7.1. Keep id, definition.name, sourceVersion, requestedFor.displayName and finishTime.

  2. 2Walk the timeline

    GET .../_apis/build/builds/{buildId}/timeline?api-version=7.1 returns stages, jobs and tasks as records. Take the records with result failed, follow parentId up to name the stage and job, and read the task's issues where type is error.

  3. 3Get the error lines

    When issues is empty or vague, fetch the failing task's log from log.url and keep the first lines that contain ##[error], plus the two lines before them.

  4. 4Check whether main is still red

    Query the same definition with definitions={id}&branchName=refs/heads/main&$top=1&queryOrder=finishTimeDescending. If the newest completed run succeeded, mark the failure as fixed.

  5. 5

    5Report

    Still-failing pipelines first, each with stage, task, the first error line, the commit and who triggered it; fixed ones after in one line each.

  6. Post it to the board

    With BRIEFKIN_TOKEN set, the agent sends the result as one card that updates in place every run. Without it, you get the report in the chat.

Install and run it

Pick your agent, where the data comes from and how to schedule it; the commands below follow.

Agent
Data
Schedule
  1. Install the skill

    One command. It puts the SKILL.md in ~/.claude/skills and in ~/.agents/skills, which Codex, Cursor, Gemini CLI, Copilot CLI and OpenCode read too.

    shellcurl -fsSL https://briefkin.dev/skills/azure-devops-failed-pipelines/install | sh
  2. Run it

    Ask Claude Code:

    promptRun the azure-devops-failed-pipelines skill

    Or paste the prompt instead of installing:

    promptUsing the Azure DevOps REST API (read only), list builds in my projects that failed on refs/heads/main in the last 24 hours: GET /{project}/_apis/build/builds?branchName=refs/heads/main&resultFilter=failed&minTime=<24h ago>&api-version=7.1. For each, read the timeline (GET /_apis/build/builds/{buildId}/timeline) and find the failed records: name the stage, job and task, and give the first error from the task's issues, or from its log (lines with ##[error]) if issues are empty. Add the commit (sourceVersion) and requestedFor. Then check the latest run of the same definition on main and say whether main is still failing or was fixed. Put still-failing pipelines first.
  3. Put it on a schedule

    Weekdays at 8:00, from cron on any machine where Claude Code is signed in:

    crontab0 8 * * 1-5 claude -p "Run the azure-devops-failed-pipelines skill"

    Add it with crontab -e. A laptop asleep at that time runs it when it wakes if you use launchd or Task Scheduler instead; GitHub Actions works for the API route.

  4. Send it to your board

    Connect Briefkin once with curl -fsSL https://briefkin.dev/install | sh and every run lands on your board as a report card. How setup works

View the SKILL.mdRaw file
SKILL.md---
name: azure-devops-failed-pipelines
description: "Each weekday morning: Azure Pipelines runs that failed on main since yesterday, with the failing stage, task and first error, and whether main is still red. Use when the user asks for this, or when it runs on a schedule."
---

# Azure DevOps failed pipelines

Each weekday morning: Azure Pipelines runs that failed on main since yesterday, with the failing stage, task and first error, and whether main is still red.

Azure DevOps emails the person who queued a failed run, and the Pipelines page shows a red icon per definition without saying which of twelve stages failed or why. Finding the real error means opening the run, expanding the job and scrolling a long log.

The agent does that walk through the build timeline for every failed run on main, takes the first error the failing task reported, and checks whether a later run passed. The card lists only what is broken now, with the error text and who triggered it.

## Two ways to get the data

Use the API or MCP route when you have an MCP server, a CLI or an API token for the app. Otherwise, if you can drive a browser the user is signed in to (Claude in Chrome, a Playwright or Chrome DevTools MCP server), use the browser route. Say which one you used.

## Route A: API or MCP server

### What you need

- A personal access token with Build (Read) scope (`vso.build`) in `AZURE_DEVOPS_PAT`, and the organization and project names.
- Or the Azure DevOps MCP server (`https://mcp.dev.azure.com/{organization}`) in read-only mode.

If something is missing, say what and stop; do not invent numbers.

### Steps

1. **List failed runs on main** (Azure DevOps): Per project: `GET https://dev.azure.com/{organization}/{project}/_apis/build/builds?branchName=refs/heads/main&resultFilter=failed&minTime=<24 hours ago>&queryOrder=finishTimeDescending&api-version=7.1`. Keep `id`, `definition.name`, `sourceVersion`, `requestedFor.displayName` and `finishTime`.
2. **Walk the timeline** (Azure DevOps): `GET .../_apis/build/builds/{buildId}/timeline?api-version=7.1` returns stages, jobs and tasks as records. Take the records with `result` `failed`, follow `parentId` up to name the stage and job, and read the task's `issues` where `type` is `error`.
3. **Get the error lines** (Azure DevOps): When `issues` is empty or vague, fetch the failing task's log from `log.url` and keep the first lines that contain `##[error]`, plus the two lines before them.
4. **Check whether main is still red** (Azure DevOps): Query the same definition with `definitions={id}&branchName=refs/heads/main&$top=1&queryOrder=finishTimeDescending`. If the newest completed run `succeeded`, mark the failure as fixed.
5. **Report**: Still-failing pipelines first, each with stage, task, the first error line, the commit and who triggered it; fixed ones after in one line each.

## Route B: the browser

### What you need

- Signed in to Azure DevOps with an account that can view builds in the project (Basic or Stakeholder access with Build read permission).

If something is missing, say what and stop; do not invent numbers.

### Steps

Start at https://dev.azure.com/. The user is signed in already; never type passwords or codes, and ask if a sign-in page appears.

1. **Open the project's pipeline runs**: Pick the organization and project, then **Pipelines > Pipelines** in the left menu and the **Runs** tab, which lists runs across every pipeline in the project, newest first.
2. **Filter to failed runs on main**: Open the filter (funnel icon) and set **Branch** to `main` and **Status** to `Failed`. Keep the runs that finished in the last 24 hours; each row shows the pipeline name, the commit message, who triggered it and the finish time.
3. **Find the failing stage and task**: Open a run. The **Summary** tab lists **Errors** with the message and the task they came from, and the stage view shows which stage went red. Click the failed job and the failed task to open its log and copy the first `##[error]` line with the two lines before it.
4. **Check whether main is still red**: Open the pipeline itself (click its name) and look at the newest run on `main`. If it succeeded, the failure is fixed; if it failed on the same task, main is still red.
5. **Report**: Still-failing pipelines first with stage, task, error line, commit and who triggered it; fixed ones after in one line each. A task that failed more than twice this week is a repeat offender.

Note: One project per pass; with several projects, repeat the steps for each. Classic release pipelines are not in the Runs list, which matches the API route. Task logs open in a viewer that loads long logs in chunks, so wait for the end before reading.

## The report

- **Still failing on main**: pipeline, stage, task, first error line, commit, who triggered it.
- **Fixed since**: failures a later run cleared.
- **Repeat offenders**: tasks that failed more than twice this week.
- One line on the first thing to check.

## Post it to Briefkin

When `BRIEFKIN_TOKEN` is set, or `~/.config/briefkin/env` exists (the installer from https://briefkin.dev/docs writes it), also send the result to the user's Briefkin board as one card. Keep the `item_key` the same on every run so the card updates in place, use a new `event_id` per run, and put today's real numbers in place of the example ones. If the request fails, say so once and carry on.

```bash
[ -n "${BRIEFKIN_TOKEN:-}" ] || . ~/.config/briefkin/env
curl -sS -X POST "${BRIEFKIN_URL:-https://briefkin.dev}/v1/events" \
  -H "authorization: Bearer $BRIEFKIN_TOKEN" \
  -H "content-type: application/json" \
  -d @- <<'JSON'
{
  "v": 1,
  "event_id": "azure-devops-failed-pipelines/<date of this run, e.g. 2026-10-16>",
  "item_key": "azure-devops-failed-pipelines",
  "project": "Acme",
  "source": "Azure DevOps failed pipelines skill",
  "kind": "update",
  "title": "Main is failing in the Test stage",
  "summary": "**2** pipelines failed on main since yesterday morning. **acme-api-ci** is still red: Test stage, task `dotnet test`, triggered by Priya at 17:42.",
  "work_state": "failed",
  "widget": [
    {
      "type": "Steps",
      "props": {
        "items": [
          {
            "label": "Build",
            "state": "done"
          },
          {
            "label": "Test: dotnet test",
            "state": "failed",
            "note": "OrderServiceTests.Refund_IsIdempotent: expected 1 refund, found 2"
          },
          {
            "label": "Publish artifacts",
            "state": "skipped"
          },
          {
            "label": "Deploy to staging",
            "state": "skipped"
          }
        ]
      }
    },
    {
      "type": "Table",
      "props": {
        "columns": [
          "Pipeline",
          "Commit",
          "Triggered by",
          "Now"
        ],
        "rows": [
          [
            "acme-api-ci",
            "a17c9e0",
            "Priya",
            "Still failing"
          ],
          [
            "acme-web-ci",
            "3be4f21",
            "Tom",
            "Fixed at 21:05"
          ]
        ]
      }
    }
  ]
}
JSON
```

Widgets come from the Briefkin catalog (https://briefkin.dev/v1/catalog). Without a token, just give the user the report.

## Run it on a schedule

Suggested: Weekdays at 8:00 (`0 8 * * 1-5`). From cron, with the agent signed in on that machine:

```bash
0 8 * * 1-5 claude -p "Run the azure-devops-failed-pipelines skill"
# Codex: codex exec, Gemini CLI: gemini -p, Copilot CLI: copilot -p, OpenCode: opencode run
```

Or use the agent's own scheduler (Claude Code routines, Codex automations, Claude or ChatGPT scheduled tasks): https://briefkin.dev/skills/azure-devops-failed-pipelines#schedule

Source: https://briefkin.dev/skills/azure-devops-failed-pipelines

What your agent needs

  • A personal access token with Build (Read) scope (vso.build) in AZURE_DEVOPS_PAT, and the organization and project names.

  • Or the Azure DevOps MCP server (https://mcp.dev.azure.com/{organization}) in read-only mode.

Connecting Azure DevOps

  1. Azure DevOps MCP Server, Microsoft's official server. The local version runs with npx: claude mcp add --transport stdio azure-devops -- npx -y @azure-devops/mcp <organization> in Claude Code, and codex mcp add azure-devops -- npx -y @azure-devops/mcp <organization> in Codex; Cursor takes the same command. Add -d repositories pipelines to load only those tool domains, and --authentication pat to use a token (then PERSONAL_ACCESS_TOKEN holds the base64 of <email>:<pat>) instead of the interactive sign-in (source). Microsoft also runs a remote server in preview at https://mcp.dev.azure.com/{organization} for organizations backed by Microsoft Entra ID; its docs point Claude Code, Codex and Cursor to the local server where their sign-in flow isn't supported yet.
  2. Azure CLI. With the azure-devops extension, az repos pr list --reviewer <you> --status active and az pipelines runs list --result failed --branch main cover the same reports.
  3. REST API with a personal access token. Create one under User settings > Personal access tokens, store it in AZURE_DEVOPS_PAT with AZURE_DEVOPS_ORG, and send basic auth with an empty username.

Limit the token to one organization with Code (Read), Build (Read) and Work Items (Read) and a short expiry; with those scopes it can't vote, complete a pull request or queue a build.

Questions

Does it cover classic release pipelines?

No. Classic releases use the separate Release API. YAML pipelines, including multi-stage ones that deploy, are builds in the REST API, so they are covered, deployment stages included.

Our default branch is not main. What changes?

Only the branchName value. Use the full ref, for example refs/heads/master or refs/heads/develop, and the agent checks that branch. You can list several branches, and each is reported on its own.

Do I need Briefkin to use the Azure DevOps failed pipelines skill?

No. The skill runs with your own agent and gives you the report in the chat. With a Briefkin token set, each run also posts it to your board as a report card, so you can glance at it instead of asking again.

Which agents can run it?

Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot CLI, OpenCode, Windsurf and Amp all read SKILL.md files. The install command puts it in ~/.claude/skills and ~/.agents/skills, where they look. ChatGPT, the Claude app and Grok take the prompt instead. Pick your agent under "Install and run it" and the commands change to match.

Can it work without an API or MCP server, from my browser?

Yes. Switch the data source to "Your browser" and the steps change to the Azure DevOps pages themselves: the agent opens dev.azure.com in a browser you are signed in to and reads the numbers off the page. Claude Code, Codex, Cursor, Claude app and ChatGPT can drive a browser out of the box; Gemini CLI, Copilot CLI and OpenCode need a Playwright or Chrome DevTools MCP server first. It is slower than the API and needs you signed in, so it suits a report you run by hand or from a scheduler on your own computer.

Read this report on your board, not in a chat log

Skills are free to use with any agent. Briefkin is where their results land: one board for every report, number and question your agents send, with a ping when something needs you.

Free during the open beta. No card.