How to add, remove, and use build tags

Azure DevOps Services | Azure DevOps Server 2022 | Azure DevOps Server 2020

Build tags in Azure DevOps let you categorize and organize your builds. Tags make it easier to filter and search for specific builds. In this article, learn how to add, remove, and use build tags in Azure DevOps.

Prerequisites

An Azure DevOps organization and access to a project where you are a member of the Contributors group.

Add a build tag to a completed build

To add a tag to a completed build:

  1. Open your Azure DevOps project and go to Pipelines.

  2. Select the pipeline where you want to add a tag.

    Screenshot of selecting the pipeline to add a tag.

  3. Select More actions and choose Add tags to add your first tag or Edit tags if you have an existing tag.

    Screenshot of select option to add tag.

  4. Enter a tag name (example: contoso).

    Screenshot of adding a new build tag.

  5. Press Enter to save the tags.

Remove a build tag

To remove build tags from your builds in Azure DevOps, follow these steps:

  1. Open your Azure DevOps project and go to Pipelines.

  2. Select the pipeline where you want to remove a tag.

  3. Select More actions and choose Edit tags.

  4. Select the X next to the tag name to remove your tag.

    Screenshot of removing build tag.

  5. Press Save to save the changes.

Add a build tag to a future build

To add a build tag to a build in a YAML pipeline, use the addbuildtag logging command.

In the following example a new tag gets added in a script task with a variable that includes the current date.

steps:
- script: |
    last_scanned="last_scanned-$(date +%Y%m%d)"
    echo "##vso[build.addbuildtag]$last_scanned"
  displayName: 'Apply last scanned tag'

Filter with a build tag

Once you have added build tags to your builds, you can use them to filter and search for specific builds. To use build tags in Azure DevOps, follow these steps:

  1. Open your Azure DevOps project and go to Pipelines.

  2. Select Runs tab.

  3. In the filter bar, select the tag that you want to filter by.

    Screenshot of selecting tag to filter by.

  4. Azure DevOps will filter the builds based on the specified tag, allowing you to find the runs you need.