I am trying the below code to retrieve the Azure-Key vault secret from the release pipeline. But I am not able to print the exact string using the below code
(Get-AzKeyVaultSecret -vaultName "keyvalultname" -name "Password").SecretValueText
$Password= (Get-AzKeyVaultSecret -vaultName "keyvalultname" -name "Password").SecretValueText
$Password
Write-Output 'DBPassword is $Password'
Write-Host 'DBPassword is $Password'
if ($Password-eq "Password01")
{
Write-Host "1"
}
else
{
Write-Host "0"
}
Write-Host $($Password.Username)
Nowhere in the above code, I am getting the value "Password01". But I am able to print 1 in the IF condition.
The output I got is given below
2019-12-09T14:01:45.9967410Z ***
2019-12-09T14:01:45.9972871Z DBPassword is $Password
2019-12-09T14:01:45.9984181Z DBPassword is $Password
2019-12-09T14:01:45.9992966Z 1
2019-12-09T14:01:46.0026811Z
2019-12-09T14:01:46.0030953Z