Skip to content
safran

Type to search. Enter opens the first result.

    Azure Boards

    The azure-boards tracker reads work items from Azure DevOps Services (dev.azure.com) and from Azure DevOps Server: fields, comments, attachments, links, update history and search, including raw WIQL. It is read-only. This page covers the profile entry, how the project allow-list works, which references it accepts and what is unverified.

    Profile entry

    - id: boards
      type: azure-boards
      organization: acme
      projects: [Platform]
      token_env: AZURE_DEVOPS_PAT

    A work item is named by its number. Three forms reach it:

    safran ticket 1423
    safran ticket AB#1423
    safran ticket https://dev.azure.com/acme/Platform/_workitems/edit/1423
    read-work-item.ts
    import { createSafran } from "@safran/core";
    
    await using safran = await createSafran({ profile: "safran.yaml" });
    
    const item = await safran.tickets.get("AB#1423");
    console.log(item.key, item.type, item.status, item.fields["Story points"]);
    
    const history = await safran.tickets.history("boards:1423", { limit: 20 });
    for (const entry of history.items) console.log(entry.at, entry.field, entry.from, "→", entry.to);

    Authentication

    token_env names a variable holding a personal access token with the Work Items (Read) scope. It is sent as HTTP Basic with an empty user name, on every request, together with a header that asks Azure DevOps for a 401 instead of a redirect to its sign-in page.

    An invalid or expired token is often not answered with 401: Azure DevOps sends HTTP 203, or 200, with an HTML sign-in page. The connector treats any 203, any HTML answer and any redirect that leads to a sign-in address as AUTH_FAILED, with a hint naming the variable. Redirects are never followed with the token attached.

    Azure DevOps Server

    - id: boards
      type: azure-boards
      url: https://tfs.acme.test/tfs
      organization: DefaultCollection
      project: Platform
      token_env: AZURE_DEVOPS_PAT
      api_version: "6.0"

    url is the server root in front of the collection, and organization is the collection name. Requests go to <url>/<organization>/…. Older servers need a lower api_version.

    The connection fields (organization, url, project / projects, api_version) have the same names and meaning as in the azure-repos code host, so one organization is described the same way in both entries.

    Configuration reference

    FieldTypeDefaultRequiredMeaning
    idstringyesName of this entry.
    type"azure-boards"yesSelects this plugin.
    organizationstringyesOrganization on dev.azure.com, or the collection name on Azure DevOps Server. A name, not a path or URL.
    urlURLhttps://dev.azure.comnoAzure DevOps Server only: the server root in front of the collection.
    projectstringnoShorthand for a single entry in projects.
    projectsstring[][]noProject names this tracker owns. When the list is not empty, work items of other projects are refused.
    token_envvariable nameyesVariable holding a personal access token with Work Items (Read) scope.
    api_versionstring"7.1"noREST API version, like "7.1" or "7.1-preview.3". Quote it in YAML.
    custom_fieldsstring[][]noField reference names (e.g. Custom.RiskLevel) copied into Ticket.fields.

    project and projects are merged. Project names are compared case-insensitively.

    The project allow-list

    When project or projects is set, the list is a boundary, not a filter on search only:

    • Reading a work item, its comments, attachments, links or history checks the project the work item is really in, from the response, and fails with FORBIDDEN when that project is not listed. The hint names the profile field to change.
    • listProjects returns only the listed projects.
    • A neutral search is restricted to them.
    • A URL that names another project is not recognised as a reference.

    With an empty list, every project the token can see is readable.

    Ticket references

    The canonical key is the bare id, 1423.

    InputResult
    14231423
    AB#1423, ab#14231423
    0014231423
    #1423not matched
    0, or a number above 2147483647not matched
    https://dev.azure.com/acme/Platform/_workitems/edit/14231423
    https://dev.azure.com/acme/_workitems/edit/1423 (no project)1423
    https://dev.azure.com/acme/Other/_workitems/edit/1423 with projects: [Platform]not matched
    https://acme.visualstudio.com/Platform/_workitems/edit/14231423
    REST …/_apis/wit/workItems/14231423
    Board, backlog, sprint or query URL with ?workitem=14231423
    Any of these on another host or organizationnot matched
    • AB#1423 is the form Azure Boards documents for mentions from commits and pull requests.
    • #1423 is deliberately not matched: it is GitHub's issue syntax, and matching it here made a profile with both trackers ambiguous. No other built-in tracker claims a bare number or AB#, so these two forms never collide.
    • The legacy host <organization>.visualstudio.com is accepted only when url is the default https://dev.azure.com.
    • Naming the tracker does not change what is matched: boards:1423 and boards:AB#1423 resolve, boards:#1423 does not. Only the tracker object's own methods accept #1423 (safran.trackers.get("boards")?.getTicket("#1423")), because there the tracker is already chosen.

    A bare number is the one form no other built-in tracker accepts, so Azure Boards can share a profile with Jira, Linear and GitHub Issues without projects lists.

    What a ticket contains

    Ticket fieldSource in Azure Boards
    keyThe work item id
    title, type, statusSystem.Title, System.WorkItemType, System.State
    statusCategoryThe state's category in the project's process: Proposed → todo; InProgress and Resolved → in_progress; Completed and Removed → done
    projectSystem.TeamProject
    descriptionSystem.Description as Markdown; when it is empty, "Repro steps" (where bugs keep their text)
    labelsSystem.Tags, split on ;
    priorityMicrosoft.VSTS.Common.Priority
    assignee, reporterSystem.AssignedTo, System.CreatedBy
    parentSystem.Parent, or the reverse hierarchy relation
    resolvedAtClosed date, otherwise resolved date

    statusCategory needs one extra request per project (the work item types and their states), cached for the life of the instance. It is best effort: when that request fails, the ticket is returned without a category.

    Ticket.fields

    These fields are copied when present, under readable names: Acceptance criteria, Repro steps, System info, Story points, Effort, Size, Original estimate, Remaining work, Target date, Severity, Value area, Area, Iteration, Reason, Board column. Rich text is converted to Markdown.

    custom_fields adds more by reference name; a field without a known label keeps its reference name as the key:

    - id: boards
      type: azure-boards
      organization: acme
      projects: [Platform]
      token_env: AZURE_DEVOPS_PAT
      custom_fields: [Custom.RiskLevel, Custom.CustomerName]

    A neutral TicketSearchQuery is turned into WIQL. Values go into quoted literals.

    Query fieldWIQL
    projects (or the entry's projects when absent)[System.TeamProject] IN ('Platform')
    text([System.Title] CONTAINS '…' OR [System.Description] CONTAINS '…')
    statusCategories[System.State] IN (…) with the state names that belong to those categories
    updatedSince[System.ChangedDate] >= '…'
    alwaysORDER BY [System.ChangedDate] DESC
    • State names are defined per project, so a statusCategories filter needs a project: in the query or on the entry. Without one the search fails with INVALID_INPUT. Because the same state name can sit in different categories for different work item types, results are filtered once more by category after loading.
    • WIQL returns ids only and has no offset. A search reads at most the first AZURE_MAX_SEARCH_RESULTS matches; titles and states are then loaded AZURE_BATCH_SIZE at a time. Work items the token cannot read are left out of the page.
    • text is cut to 250 characters.

    Native WIQL

    search-wiql.ts
    import { createSafran } from "@safran/core";
    
    await using safran = await createSafran({ profile: "safran.yaml" });
    
    const wiql = "SELECT [System.Id] FROM WorkItems WHERE [System.TeamProject] = 'Platform' AND [System.Tags] CONTAINS 'iade'";
    const page = await safran.tickets.search({ native: wiql }, { tracker: "boards" });
    for (const item of page.items) console.log(item.key, item.title);

    native is sent as written. A query Azure DevOps rejects (HTTP 400 or 422) becomes INVALID_INPUT with the server's message in the hint.

    • Comments are read oldest first with the server's continuation token; deleted comments are skipped. The comments resource is a preview API: the connector asks for <api_version>-preview.4.
    • Links returns work item relations (parent, child, and other link types by their name in lower case) with the linked item's title and state, then hyperlinks and artifact links as web links. Links to pull requests and commits are turned from vstfs:/// URIs into web URLs. Titles are loaded for at most AZURE_BATCH_SIZE linked items; the rest are returned with their id only.
    • History is read from work item updates. Bookkeeping fields that change on every revision (revision number, changed date, watermark and similar) are dropped; added and removed relations appear as Link entries. Values are cut to AZURE_HISTORY_VALUE_CHARS characters.
    • Attachments are the work item's AttachedFile relations; ids are GUIDs. A download must name an attachment of that work item (NOT_FOUND otherwise), is refused above MAX_ATTACHMENT_BYTES, and an HTML answer for a file that is not HTML is reported as AUTH_FAILED (it is the sign-in page).

    Limits

    ConstantValueMeaning
    DEFAULT_PAGE_SIZE / MAX_PAGE_SIZE50 / 100Comments, history entries and search results per page.
    AZURE_MAX_SEARCH_RESULTS1000Matches one search can page through.
    AZURE_BATCH_SIZE200Work items loaded per batch request; also the cap on linked items with titles.
    AZURE_HISTORY_VALUE_CHARS500Characters kept of each old and new value in history.
    AZURE_MAX_PROJECT_PAGES10Pages of 200 projects read by listProjects.
    MAX_ATTACHMENT_BYTES50 MiBLargest attachment that is downloaded.

    Known caveats

    This connector is implemented from Microsoft's REST documentation (version 7.1) and tested against recorded-shape fixtures; it has not been run against a live organization. See verification status. The following are marked UNVERIFIED in the source:

    • Quotes in search text. A single quote inside a WIQL literal is written twice. The WIQL syntax page shows quoted literals but not this rule; it is how the query editor behaves.
    • State categories. The connector expects the work item type list of a project to embed each type's states with their category. The documented per-type resource has exactly that shape; the list was not confirmed to. If it does not, tickets come back without statusCategory and a statusCategories search matches nothing.
    • Pull request and commit links. The vstfs:///Git/PullRequestId/… and vstfs:///Git/Commit/… layouts are not in the REST reference. A URI of another shape is returned unchanged as the link's URL.

    One more thing to know: the comment id is read from id, and from commentId when id is absent, because the reference and its sample payload disagree.

    See also