This Azure PowerShell article will discuss the syntax and usage of the Get-AzKeyVaultSecret PowerShell command with examples.
Table of Contents
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.

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.

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.

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.

I am Rajkishore, and I have over 14 years of experience in Microsoft Azure and AWS, with good experience in Azure Functions, Storage, Virtual Machine, Logic Apps, PowerShell Commands, CLI Commands, Machine Learning, AI, Azure Cognitive Services, DevOps, etc. Not only that, I do have good real-time experience in designing and developing cloud-native data integrations on Azure or AWS, etc. I hope you will learn from these practical Azure tutorials. Read more.