Thanks Durga tried above and also one different method it worked. Thanks for your help.
Azure Devops - Issue while Extracting the Secret Value of the Key-Vault
I am getting the below Issue the Secret of the Key-Vault is coming as *** but after Base64 encoding it shows correct encoded-value.
But in Azure Devops PowerShell was facing issue while decoding the Encoded Base64 Key-Vault value.
- Then in PowerShell Script, to extract the Key-Vault values with the below command
$keyVaultValue = (Get-AzKeyVaultSecret -VaultName "xxx" -Name "DBPass")
Write-Host "Value of Value": $keyVaultValue
---- Output
Value of keyVaultValue : ***
After Encoding in Base64 for the above value of (keyVaultValue) getting the correct encoded-value. Checked in the base64 decode website (https://www.base64decode.org/) by encoded-value to check the decoded-value. ( Decoded-value is correct)
Encoded-Value
$encodedSecret = [Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($keyVaultValue))
Write-Host "Value of encodedSecret" $encodedSecret
---Output - for-example
Value of encodedSecret - xyz
Decoded-value
$decodedvalue = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String('xyz'))
Write-Host "Value of DecodedSecret" $decodedvalue
---- Output
Value of decodedvalue : ***