

Get-AzKeyVaultSecret -VaultName 'Contoso' -Name 'secret1' -InRemovedState Example 7: Gets the secret ITSecret that has been deleted but not purged for this key vault. This command gets all the secrets that have been previously deleted, but not purged, in the key vault named Contoso. Get-AzKeyVaultSecret -VaultName 'Contoso' -InRemovedState Example 6: Get all the secrets that have been deleted but not purged for this key vault. not providing -Name, the -AsPlainText is ignored. The cmdlet returns the secret as a string when -AsPlainText is applied. Example 5: Get the plain text value of the current version of a specific secret $secretText = Get-AzKeyVaultSecret -VaultName 'Contoso' -Name 'ITSecret' -AsPlainText

This command gets a specific version of the secret named secret1 in the key vault named Contoso. Example 4: Get a specific version of a specific secret Get-AzKeyVaultSecret -VaultName 'Contoso' -Name 'secret1' -Version '5d1a74ba2c454439886fb8509b6cab3c' This command gets the current version of the secret named secret1 in the key vault named Contoso. Example 3: Get the current version of a specific secret Get-AzKeyVaultSecret -VaultName 'Contoso' -Name 'secret1' This command gets all versions of the secret named secret1 in the key vault named Contoso. Example 2: Get all versions of a specific secret Get-AzKeyVaultSecret -VaultName 'Contoso' -Name 'secret1' -IncludeVersions This command gets the current versions of all secrets in the key vault named Contoso. Examples Example 1: Get all current versions of all secrets in a key vault Get-AzKeyVaultSecret -VaultName 'Contoso' This cmdlet gets a specific secret or all the secrets in a key vault. The Get-AzKeyVaultSecret cmdlet gets secrets in a key vault. In this article Syntax Get-Az Key Vault Secret
