I am trying to retrieve azure secret variables in a pipeline but for some reason I am not getting the values. So far I have setup the secrets in Azure
And added the variables
So in the pipline the service connection has been created
Then the variable group is created and linked to the azure Key vault
And permissions are set
And the actual pipeline itself we have
pool:
vmImage: 'ubuntu-20.04'
steps:
- task: AzureKeyVault@2
displayName: Azure Key Vault
inputs:
azureSubscription: 'TestSecrets'
KeyVaultName: 'SpiceKVT'
SecretsFilter: 'UserId'
RunAsPreJob: false
env:
uid: $(UserId)
- task: PowerShell@2
displayName: Show UserId
inputs:
targetType: 'inline'
script: 'Write-Host "User Login is $(uid)"'
But all I get is an empty value in $(uid), any ideas on what I am missing please
@Alvin Zhao - Even I was facing the same issue , how to print the actual value of the secret in Powershell as it showing *. In Powershell script, added the below but still its showing *** values for the secret.
$keyVaultValue = Get-AzKeyVaultSecret -VaultName "xxx" -Name "DBPass" - AsPlainText
Write-Host "Value of Value": $keyVaultValue
--Output
$keyVaultValue - ***
2. Also tried the below facing same issue showing ***
#$secret = (Get-AzKeyVaultSecret -VaultName "XXX" -Name "DBPass").SecretValueText