Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

View contents of Secret in Azure KeyVault

This may seem like a very basic question, but I've created a KeyVault in Azure and have added two Secrets to it which are plain text 'hello world' examples secured using ConvertTo-SecureString.

Using Get-AzureKeyVaultSecret I can see that the two entries are there, and also see the unique URIs for each one, however I can't seem to work out any way to actually retrieve the 'hello world' text I've added into each secret.

Can anyone provide the missing link, as the current documentation on the Microsoft site isn't too expansive at present.

like image 665
AndyHerb Avatar asked Jan 20 '16 17:01

AndyHerb


1 Answers

Something like this should do it...

$key = Add-AzureKeyVaultKey -VaultName DeploymentVault `
                            -Name test1 -Destination Software

$securepwd = ConvertTo-SecureString –String '123' –AsPlainText –Force

$secrets = Set-AzureKeyVaultSecret -VaultName DeploymentVault `
                                   -Name test1 `
                                   -SecretValue $securepwd

$secret = Get-AzureKeyVaultSecret -VaultName DeploymentVault -Name test1

$secret.SecretValueText

which returns 123

like image 148
Michael B Avatar answered Oct 23 '22 18:10

Michael B