Use secure files
Azure DevOps Services | Azure DevOps Server 2020 | Azure DevOps Server 2019 | TFS 2018
Secure files give you a way to store files that you can share across pipelines. Use the secure files library to store files such as:
- signing certificates
- Apple Provisioning Profiles
- Android Keystore files
- SSH keys
These files can be stored on the server without having to commit them to your repository.
The contents of the secure files are encrypted and can only be used when you consume them from a task. Secure files are a protected resource. You can add approvals and checks to them and set pipeline permissions. Secure files also can use the Library security model.
The size limit for each secure file is 10 MB.
In Microsoft Team Foundation Server (TFS) 2018 and previous versions, build and release pipelines are called definitions, runs are called builds, service connections are called service endpoints, stages are called environments, and jobs are called phases.
Add a secure file
Go to Pipelines > Library > Secure files.
Select Secure file to upload a new secure file. Browse to upload or drag and drop your file. You can delete this file, but you can't replace it.
Add permissions to your file.
- Apply security role restrictions for all files from the Security tab at Pipelines > Library.
- To add permissions for an individual file, in the file's edit view, select Pipeline permissions to set per-pipeline permissions. Or, select Security to set security roles.
- You can also set Approvals and Checks for the file. For more information, see Approvals and checks.
Consume a secure file in a pipeline
Use the Download Secure File utility task to consume secure files in a pipeline.
The following YAML pipeline example downloads a secure certificate file and installs it in a Linux environment.
- 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 -t /etc/ssl/certs/ $(caCertificate.secureFilePath)
Q: How can I create a custom task using secure files?
A: Build your own tasks that use secure files by using inputs with type
secureFile in the
Learn how to build a custom task.
To handle secure files during build or release, you can refer to the common module available here.
Q: My task can't access the secure files. What do I do?
A: Make sure your agent is running version of 2.116.0 or higher. See Agent version and upgrades.
Q: How do I authorize a secure file for use in a specific pipeline?
- In Azure Pipelines, select the Library tab.
- Select the Secure files tab at the top.
- Select the secure file you want to authorize.
- Select the Pipeline permissions button.
- Review and modify the access for each available pipeline.
Q: Why do I see an
Invalid Resource error when downloading a secure file with Azure DevOps Server/TFS on-premises?
A: Make sure IIS Basic Authentication is disabled on the TFS or Azure DevOps Server.
Q: How are secure files secured?
A: Secure files, variable groups, and service connections are all secured in the same way in Azure DevOps. They're also all protected resources.
Secrets are encrypted and stored in the database. The keys to decrypt secrets are stored in Azure Key Vault. The keys are specific to each scale unit. So, two regions don't share the same keys. The keys are also rotated with every deployment of Azure DevOps.
The rights to retrieve secure keys are only given to the Azure DevOps service principals and (on special occasions) on-demand to diagnose problems. The secure storage doesn't have any certifications.
Submit and view feedback for