Get-AzKeyVaultSecret PowerShell

This Azure PowerShell article will discuss the syntax and usage of the Get-AzKeyVaultSecret PowerShell command with examples.

Get-AzKeyVaultSecret

This PowerShell command can help you retrieve the secret lists or a specific secret in a key vault.

Syntax of Get-AzKeyVaultSecret

Below are the syntax lists of the Get-AzKeyVaultSecret PowerShell command.

Get-AzKeyVaultSecret
 [-VaultName] <String>
Get-AzKeyVaultSecret
 [-VaultName] <String>
 [-Name] <String>

Examples

Example-1: Get the secret lists from the specified key vault.

You can execute the below PowerShell command to get the complete list of secrets available in the specified key vault.

Get-AzKeyVaultSecret -VaultName 'FordMotor'

After executing the above PowerShell command, I got the expected output below.


Vault Name   : fordmotor
Name         : fordsecret
Version      : 
Id           : https://fordmotor.vault.azure.net:443/secrets/fordsecret
Enabled      : True
Expires      : 
Not Before   : 
Created      : 20-11-2023 06:28:21
Updated      : 20-11-2023 06:28:21
Content Type : 
Tags         : 

Vault Name   : fordmotor
Name         : fordsecret2
Version      : 
Id           : https://fordmotor.vault.azure.net:443/secrets/fordsecret2
Enabled      : True
Expires      : 
Not Before   : 
Created      : 20-11-2023 06:47:18
Updated      : 20-11-2023 06:47:18
Content Type : 
Tags         : 

Check out the screenshot below to see that I have executed the above command and got the expected output.

Get-AzKeyVaultSecret

Example 2: Get the latest version and details of the specified secret

You can execute the below PowerShell command.

Get-AzKeyVaultSecret -VaultName 'FordMotor' -Name 'fordsecret2'

After executing the above command, I got the expected output below. Check out the screenshot below.

Get-AzKeyVaultSecret PowerShell

Example 3: Get the details of the specified secret as plain text.

You can execute the below PowerShell command.

Get-AzKeyVaultSecret -VaultName 'FordMotor' -Name 'fordsecret2' -AsPlainText

After executing the PowerShell command, I got the expected output in the screenshot below.

powershell get-azkeyvaultsecret

Get-AzKeyVaultSecret – Video Tutorial

You may also like following the articles below

Conclusion

In this Azure article, we discussed the syntax and usage of the Get-AzKeyVaultSecret PowerShell command with examples.