LosManos
LosManos

Reputation: 7702

Retrieve the secret value from Azure Keyvault with Az.KeyVault Powershell module

With Azure CLI one uses
az keyvault secret show
to read the secret value.

How is it done with Azure Powershell/Az.KeyVault?

I have tried GetAzKeyVaultSecret but it returns the record without the secret value.

Upvotes: 2

Views: 20046

Answers (1)

kobulloc
kobulloc

Reputation: 259

Get-AzKeyVaultSecret in the Azure Az PowerShell module is the equivalent of az keyvault secret show in the Azure CLI:

PowerShell Az Module

$keyVaultValue = Get-AzKeyVaultSecret -VaultName "kobulloc-keyvaultAZPS" -Name "ExampleAZPSPassword"
$keyVaultValue.SecretValue | ConvertFrom-SecureString -AsPlainText

enter image description here

CLI

az keyvault secret show --name "ExampleCLIPassword" --vault-name "kobulloc-keyvaultCLI" --query "value"

enter image description here

References:

Upvotes: 6

Related Questions