Sdílet prostřednictvím


DownloadSecureFile@1 - Download secure file v1 task

Use this task to download a secure file to a temporary location on the build or release agent.

Inputs

secureFile - Secure File
string. Required.

Specifies the name or unique identifier (GUID) of the secure file that is downloaded to the agent machine. The file is deleted when the pipeline job completes.


Task control options

All tasks have control options in addition to their task inputs. For more information, see Control options and common task properties.

Output variables

This task defines the following output variables, which you can consume in downstream steps, jobs, and stages.

secureFilePath
Specifies the location of the secure file that was downloaded.

Remarks

Use this task in a pipeline to download a secure file to the agent machine. When specifying the name of the file (using the secureFile input), use the name you specified when uploading it, rather than the actual file name.

Once downloaded, use the name value that is set on the task (or "Reference name" in the classic editor) to reference the path to the secure file on the agent machine. For example, if the task is given the name mySecureFile, its path can be referenced in the pipeline as $(mySecureFile.secureFilePath). Alternatively, downloaded secure files can be found in the directory given by $(Agent.TempDirectory). See a full example below.

When the pipeline job completes, whether it succeeds, fails, or is canceled, the secure file is deleted from its download location.

It is unnecessary to use this task with the Install Apple Certificate or Install Apple Provisioning Profile tasks because they automatically download, install, and delete (at the end of the pipeline job) the secure file.

This task currently supports only one file task per instance.

Examples

This example downloads a secure certificate file and installs it to a trusted certificate authority (CA) directory on Linux:

- task: DownloadSecureFile@1
  name: caCertificate
  displayName: 'Download CA certificate'
  inputs:
    secureFile: 'myCACertificate.pem'

- script: |
    echo Installing $(caCertificate.secureFilePath) to the trusted CA directory...
    sudo chown root:root $(caCertificate.secureFilePath)
    sudo chmod a+r $(caCertificate.secureFilePath)
    sudo ln -s $(caCertificate.secureFilePath) /etc/ssl/certs/ 

Requirements

Requirement Description
Pipeline types YAML, Classic build, Classic release
Runs on Agent, DeploymentGroup
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command restrictions Any
Settable variables Any
Agent version 2.116.0 or greater
Task category Utility