I have following tasks in a pipeline (Azure DevOps). First task read a secret from a KeyVault using a variable $(mySecretName) which value is secret-name. Second task needs to pass the value of the read secret to a ARM:
- task: AzureKeyVault@2
displayName: 'Read secret'
inputs:
azureSubscription: $(mySubscription)
KeyVaultName: $(myKeyVault)
SecretsFilter: $(mySecretName)
RunAsPreJob: false
- task: AzureResourceGroupDeployment@3
displayName: 'Use secret value'
inputs:
resourceGroupName: $(myResourceGroup)
location: $(myLocation)
azureResourceManagerConnection: $(mySubscription)
templateLocation: 'Linked artifact'
csmFile: '$(Pipeline.Workspace)/cd-template.json'
overrideParameters: >
-secretValue "$($(mySecretName))"
deploymentMode: 'Incremental'
In line -secretValue "$($(mySecretName))" I'm trying to resolve in this way but apparently it does not work: $(mySecretName) -> $(secret-name) -> secret value. If I use $(secret-name) it will work, but I need to use $(mySecretName) because the name will change depending on the environment.
Is there any solution that allows me to get the value of a variable which name is the value of another variable?