Recently I am facing problem with my variable containing secret from KeyVault.
I am retrieving ssh keys from KeyVault with following code and this works fine (in this case there is only one key under kv_key_list variable - ansibleprvk but there also could be few of them):
- task: AzureKeyVault@2
displayName: Retrieve SSH Keys from KeyVault
inputs:
azureSubscription: ${{ parameters.ADO_subscription }}
KeyVaultName: ${{ parameters.ADO_vaultName }}
SecretsFilter: $(kv_key_list)
RunAsPreJob: false
Now i need to interate over kv_key_list and save each key to temp file but that is not the case.
Right now i just want to print out this secret to pipeline and i can achieve this by hardcoding keyname like this:
- task: Bash@3
displayName: Store ssh key
inputs:
targetType: 'inline'
script: |
echo -e "$(ansibleprvk)" | base64 -d
Mentioned code prints out whole SSH Key to teh pipeline.
Knowig that uder my variable there is only one keyname i want to replace hardcoded ansibleprvk with variable like in following code but this prints out nothing:
- task: Bash@3
displayName: Store ssh key
inputs:
targetType: 'inline'
script: |
echo -e "$($(kv_key_list))" | base64 -d
What am i doing wrong? how to replace hardcoded string with variable?