Publish Pipeline Artifacts task

Azure Pipelines

Use this task in a pipeline to publish your artifacts(note that publishing is NOT supported in release pipelines. It is supported in multi-stage pipelines, build pipelines, and yaml pipelines).


Looking to get started with build artifacts? See Artifacts in Azure Pipelines.

YAML snippet

# Publish pipeline artifacts
# Publish (upload) a file or directory as a named artifact for the current run
- task: PublishPipelineArtifact@1
    #targetPath: '$(Pipeline.Workspace)' # Required 
    #artifactName: 'drop' # Optional
    #artifactType: 'pipeline' # Required. Options: pipeline, filepath. Default value: pipeline
    #fileSharePath: '\server\folderName' # Required when artifactType = filepath
    #parallel: false # Optional. Default value: false
    #parallelCount: 1 # Optional. Value must be at least 1 and not greater than 128. Default value: 8


The publish and download keywords are shortcuts for the Publish Pipeline Artifact task. You can use them in your pipeline to publish and download artifacts. For more information, see Publish and Download in the YAML schema.


Argument Description
targetPath Path to the folder or file you want to publish. The path must be a fully qualified path or a valid path relative to the root directory of your repository. (Required) See Publishing artifacts.
artifactName Your artifact name. You can specify any name you prefer. E.g.: drop (Optional)
artifactType Artifacts publish location. Choose whether to store the artifact in Azure Pipelines, or to copy it to a file share that must be accessible from the pipeline agent. (Required). Options: pipeline, filepath. Default value: pipeline
fileSharePath The file share to which the artifact files will be copied. This can include variables. Required when artifactType = filepath. E.g: \server\folderName
parallel Select whether to copy files in parallel using multiple threads for greater potential throughput. If this setting is not enabled, one thread will be used. (Optional). Default value: false
parallelCount Enter the degree of parallelism, or number of threads used, to perform the copy. (Optional) The value must be at least 1 and not greater than 128.
Control options


Q: I'm having issues with publishing my artifacts. How can I view the detailed logs?

To enable detailed logs for your pipeline:

  1. Edit your pipeline and select Variables
  2. Add a new variable with the name System.Debug and value true
  3. Save

Q: Which variables are available to me?

A: $(Build.SourcesDirectory) and $(Agent.BuildDirectory) are just few of the variables you can use in your pipeline. Variables are available as expressions or scripts.

See Define variables, predefined variables, and Classic release and artifacts variables to learn about the different types of variables.


This task is open source on GitHub. Feedback and contributions are welcome.