DownloadSecureFile@1 - Download secure file v1 task

Use this task to download a secure file to the agent machine.

Use this task to download a secure file to a temporary location on the agent machine.

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

Syntax

# Download secure file v1
# Download a secure file to the agent machine.
- task: DownloadSecureFile@1
  inputs:
    secureFile: # string. Required. Secure File. 
    #retryCount: '8' # string. Retry Count. Default: 8.
    #socketTimeout: # string. Socket Timeout.
# Download secure file v1
# Download a secure file to the agent machine.
- task: DownloadSecureFile@1
  inputs:
    secureFile: # string. Required. Secure File. 
    #retryCount: '5' # string. Retry Count. Default: 5.
# Download secure file v1
# Download a secure file to a temporary location on the agent machine.
- task: DownloadSecureFile@1
  inputs:
    secureFile: # string. Required. Secure File.
# Download Secure File v1
# Download a secure file to a temporary location on the build or release agent.
- task: DownloadSecureFile@1
  inputs:
    secureFile: # string. Required. Secure File.

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.


retryCount - Retry Count
string. Default value: 8.

Optional. Specifies the number of times to retry downloading a secure file if the download fails.


retryCount - Retry Count
string. Default value: 5.

Optional. Specifies the number of times to retry downloading a secure file if the download fails.


socketTimeout - Socket Timeout
string.

Optional. When downloading a secure file request in Microsoft, this input specifies the timeout for a socket.


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 This task runs using the following command restrictions: restricted
Settable variables This task has permission to set the following variables: secureFilePath
Agent version 2.182.1 or greater
Task category Utility
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