Azure Devops - Issue while Extracting the Secret Value of the Key-Vault

Hitesh N 20 Reputation points
2025-05-29T03:16:39.51+00:00

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.

  1. 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 : ***

Azure DevOps
0 comments No comments

6 answers

Sort by: Newest
  1. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.