Share via


Publish and download build artifacts

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

Azure Artifacts enables teams to use feeds and upstream sources to manage their dependencies. You can use Azure Pipelines to publish and download different types of artifacts as part of your CI/CD workflow.

Publish artifacts

Artifacts can be published at any stage of your pipeline. You can use YAML or the classic Azure DevOps editor to publish your packages.

Example: Use multiple tasks

Example: Copy and publish binaries

Note

Build.ArtifactStagingDirectory path is cleaned up after each build. If you're using this path to publish your artifact, make sure you copy the content you wish to publish into this directory before the publishing step.

Download artifacts

Note

If you're using a deployment task, you can reference your build artifacts using $(Agent.BuildDirectory). See Agent variables for more details.

Download a specific artifact

steps:
- task: DownloadBuildArtifacts@1
  displayName: 'Download Build Artifacts'
  inputs:
    buildType: specific                        # Options: 'current' | 'specific'. Specify which build artifacts will be downloaded: `current` or from a specific build
    project: 'xxxxxxxxxx-xxxx-xxxx-xxxxxxxxxxx'    # Required when buildType == specific. Project ID.
    pipeline: 20                                   # Required when buildType == specific. Build pipeline.
    buildVersionToDownload: specific    # Options: 'latest' | 'latestFromBranch' | 'specific'. Required when buildType == specific. Build version to download.
    buildId: 128                        # Required when buildType == specific && buildVersionToDownload == specific. Build ID.
    artifactName: drop                  # The name of the artifact that will be downloaded.
    extractTars: false                  # boolean. Extract all files that are stored inside tar archives.

Tips

  • Disable IIS Basic Authentication if you're using Azure DevOps Server to allow authentication with your Personal Access Token. For more information, see Why did my PAT stop working?.

  • Use forward slashes in file path arguments. Backslashes don't work in macOS/Linux agents.

  • Build artifacts are stored on a Windows filesystem, which causes all UNIX permissions to be lost, including the execution bit. You might need to restore the correct UNIX permissions after downloading your artifacts from Azure Pipelines.

  • Build.ArtifactStagingDirectory and Build.StagingDirectory are interchangeable.

  • Build.ArtifactStagingDirectory path is cleaned up after each build.

  • Deleting a build associated with packages published to a file share will result in the deletion of all Artifacts in that UNC path.

  • If you're publishing your packages to a file share, make sure you provide access to the build agent.

  • Make sure you allow Azure Artifacts Domain URLs and IP addresses if your organization is using a firewall.