I am trying to retrieve a password from key vault secret into a variable in an azure CLI task. But it is not populating any value. Please find below the YAML task:
- task: AzureCLI@2
displayName: Retrieve and store key vault secret
inputs:
azureSubscription: 'azureSubscription'
scriptType: pscore
scriptLocation: inlineScript
inlineScript: |
$secret=$(az keyvault secret show --name "passwordSecret" --vault-name "passwordKeyVault")
If I use $(secret) anywhere it gives me value as $(secret) only and not the password. Is it the right way to do this? Can someone please guide me through this?