I used the syntax below to get the plain text of the secret in AZ powershell:
Get-AzKeyVaultSecret -VaultName 'valt1' -Name 'url' -AsPlainText
However, I got [string]::Format
.
I also tried
(Get-AzKeyVaultSecret -VaultName $mongoKeyVault -Name $backendRwUriName).SecretValue
,
but I got System.Security.SecureString
How can I get the actual secret string as shown in the portal?
Thanks!
After reproducing from my end, I could get the desired results using the below command.
Get-AzKeyVaultSecret -VaultName "<VAULT_NAME>" -Name "<SECRET_NAME>" -AsPlainText
Unless your secret must be [string]::Format
you wont be receiving it as the result.
Firstly, I have created my secret as below.
Below are the results I got using the above command.