5
votes

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.

1

1 Answers

9
votes

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