< Back

Get-AzureKeyVaultSecret

Tue Jan 29, 2019 9:50 pm

NAME Get-AzureKeyVaultSecret



SYNOPSIS

Gets the secrets in a key vault.





SYNTAX

Get-AzureKeyVaultSecret [-VaultName] <String> [-Name] <String> [-DefaultProfile <IAzureContextContainer>] -IncludeVersions [<CommonParameters>]



Get-AzureKeyVaultSecret [-InputObject] <PSKeyVault> [-Name] <String> [-DefaultProfile <IAzureContextContainer>] -IncludeVersions

[<CommonParameters>]



Get-AzureKeyVaultSecret [-InputObject] <PSKeyVault> [[-Name] <String>] [-DefaultProfile <IAzureContextContainer>] [-InRemovedState]

[<CommonParameters>]



Get-AzureKeyVaultSecret [-InputObject] <PSKeyVault> [-Name] <String> [-Version] <String> [-DefaultProfile <IAzureContextContainer>]

[<CommonParameters>]



Get-AzureKeyVaultSecret [-VaultName] <String> [[-Name] <String>] [-DefaultProfile <IAzureContextContainer>] [-InRemovedState] [<CommonParameters>]



Get-AzureKeyVaultSecret [-VaultName] <String> [-Name] <String> [-Version] <String> [-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]





DESCRIPTION

The Get-AzureKeyVaultSecret cmdlet gets secrets in a key vault. This cmdlet gets a specific secret or all the secrets in a key vault.





PARAMETERS

-DefaultProfile <IAzureContextContainer>

The credentials, account, tenant, and subscription used for communication with azure



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-IncludeVersions [<SwitchParameter>]

Indicates that this cmdlet gets all versions of a secret. The current version of a secret is the first one on the list. If you specify this

parameter you must also specify the Name and VaultName parameters.



If you do not specify the IncludeVersions parameter, this cmdlet gets the current version of the secret with the specified Name .



Required? true

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-InputObject <PSKeyVault>

KeyVault Object.



Required? true

Position? 0

Default value None

Accept pipeline input? True (ByValue)

Accept wildcard characters? false



-InRemovedState [<SwitchParameter>]

Specifies whether to show the previously deleted secrets in the output



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-Name <String>

Specifies the name of the secret to get.



Required? false

Position? 1

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-VaultName <String>

Specifies the name of the key vault to which the secret belongs. This cmdlet constructs the fully qualified domain name (FQDN) of a key vault

based on the name that this parameter specifies and your current environment.



Required? true

Position? 0

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-Version <String>

Specifies the secret version. This cmdlet constructs the FQDN of a secret based on the key vault name, your currently selected environment,

the secret name, and the secret version.



Required? true

Position? 2

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

String







OUTPUTS

List<Microsoft.Azure.Commands.KeyVault.Models.PSKeyVaultSecretIdentityItem>, Microsoft.Azure.Commands.KeyVault.Models.PSKeyVaultSecret,

List<Microsoft.Azure.Commands.KeyVault.Models.PSDeletedKeyVaultSecretIdentityItem>,

Microsoft.Azure.Commands.KeyVault.Models.PSDeletedKeyVaultSecret







NOTES









Example 1: Get all current versions of all secrets in a key vault



PS C:\\>Get-AzureKeyVaultSecret -VaultName 'Contoso'



This command gets the current versions of all secrets in the key vault named Contoso.





Example 2: Get all versions of a specific secret



PS C:\\>Get-AzureKeyVaultSecret -VaultName 'Contoso' -Name 'ITSecret' -IncludeVersions



This command gets all versions of the secret named ITSecret in the key vault named Contoso.





Example 3: Get the current version of a specific secret



PS C:\\>Get-AzureKeyVaultSecret -VaultName 'Contoso' -Name 'ITSecret'



This command gets the current version of the secret named ITSecret in the key vault named Contoso.





Example 4: Get a specific version of a specific secret



PS C:\\>Get-AzureKeyVaultSecret -VaultName 'Contoso' -Name 'ITSecret' -Version '6A12A286385949DB8B5F82AFEF85CAE9'



This command gets a specific version of the secret named ITSecret in the key vault named Contoso.





Example 5: Get the plain text value of the current version of a specific secret



PS C:\\>$secret = Get-AzureKeyVaultSecret -VaultName 'Contoso' -Name 'ITSecret'

PS C:\\> Write-Host "Secret Value is: " $secret.SecretValueText



These commands get the current version of a secret named ITSecret, and then displays the plain text value of that secret.





Example 6: Get all the secrets that have been deleted but not purged for this key vault.



PS C:\\>Get-AzureKeyVaultSecret -VaultName 'Contoso' -InRemovedState



This command gets all the secrets that have been previously deleted, but not purged, in the key vault named Contoso.





Example 7: Gets the secret ITSecret that has been deleted but not purged for this key vault.



PS C:\\>Get-AzureKeyVaultSecret -VaultName 'Contoso' -KeyName 'ITSecret' -InRemovedState



This command gets the secret ITSecret that has been previously deleted, but not purged, in the key vault named Contoso. This command will return

metadata such as the deletion date, and the scheduled purging date of this deleted secret.







RELATED LINKS

Online Version: https://docs.microsoft.com/en-us/powers ... aultsecret

Remove-AzureKeyVaultSecret

Undo-AzureKeyVaultSecretRemoval

Set-AzureKeyVaultSecret