I want to use Azure DevOps for IoT Edge project where some secrets should be passed through json file. This is the fragment of the deployment.template.json file:
"env": {
"mappedFolder": { "value": "/temp" },
"netatmoClientId": { "value": "${netatmoClientId}" },
"netatmoClientSecret": { "value": "${netatmoClientSecret}" },
"netatmoUsername": { "value": "${netatmoUsername}" },
"netatmoPassword": { "value": "${netatmoPassword}" },
Locally everything works correctly. I have the .env file and the values in json will be replaced correctly during build.
How to use the same behavior with Azure DevOps?
I already declared devops pipeline variables but placeholders inside json file are not substituted from the variables.
This requirement can be achieved of using Secret files in Azure DevOps.
steps:
- task: DownloadSecureFile@1
displayName: 'Download secure file'
inputs:
secureFile: .env
steps:
- task: CopyFiles@2
displayName: 'Copy Files to: MyProjectName'
inputs:
SourceFolder: '$(Agent.TempDirectory)'
Contents: .env
TargetFolder: MyProjectName