Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

List all secrets with plain text from a key vault

I know that you could get the plain text for a specific secret in azure key vault with a command like this:

$a = Get-AzureKeyVaultSecret -VaultName MyKeyVaultName -Name "SecretName"
$a.SecretValueText

But is it possible to list all secrets and the plain text value? This just shows a blank string for the secret value:

Get-AzureKeyVaultSecret -VaultName MyKeyVaultName | Select-Object Name,SecretValueText
like image 218
PEK Avatar asked Oct 22 '25 14:10

PEK


2 Answers

You just need to create a loop around secrets:

$q = Get-AzureKeyVaultSecret -VaultName 'xxx'
$q.foreach{ Get-AzureKeyVaultSecret -VaultName $_.VaultName -Name $_.Name }.SecretValueText
like image 160
4c74356b41 Avatar answered Oct 24 '25 05:10

4c74356b41


You have to use this commands en powershell.

$secrets=Get-AzKeyVaultSecret -VaultName 'vaultName'
$secrets | % {Write-Output "$($_.name) |  $(Get-AzKeyVaultSecret -VaultName $_.VaultName -Name $_.Name -AsPlainText)"}
like image 32
Vodo-Siosk Baas Avatar answered Oct 24 '25 05:10

Vodo-Siosk Baas



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!