I declared connection string on the pipeline variables page as secure but in the pipeline I cannot obtain the value. I have already read related page in docs but it doesn't provide an example when I want to use a value in a task. https://learn.microsoft.com/en-us/azure/devops/pipelines/process/variables?view=azure-devops&tabs=yaml%2Cbatch#secret-variables
The task where I want to get the value you can see below
- task: AzureWebAppContainer@1
displayName: Deploy to App Service
inputs:
azureSubscription: 'free_subscription(id)'
appName: 'app-service'
containers: 'containerregistry.azurecr.io/something:$(tag)'
**WANT TO USE IT HERE**
appSettings: 'CONNECTION_STRING=$(CONNECTION_STRING)'
$(CONNECTION_STRING) returns empty string
EDIT
Updated code but it doesn't work anyway... connection string is still empty in app settings.
- stage: Deploy
displayName: Deploy to App Service
jobs:
- job: Deploy
displayName: Deploy
pool:
vmImage: ubuntu-latest
steps:
- bash: echo "##vso[task.setvariable variable=CONNECTION_STRING]$CONNECTION_STRING"
displayName: 'Set variable'
- task: AzureWebAppContainer@1
displayName: Deploy to App Service
inputs:
azureSubscription: 'free_subscription(id)'
appName: 'app-service'
containers: 'appnamecontainerregistry.azurecr.io/repository:$(tag)'
appSettings: |
[
{
"name": "CONNECTION_STRING",
"value": "$(CONNECTION_STRING)",
"slotSetting": false
}
]