Remove-Secret

Removes a secret from a specified registered extension vault.

Syntax

Remove-Secret
      [-Name] <String>
      [-Vault] <String>
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-Secret
      [-InputObject] <SecretInformation>
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]

Description

Removes a secret by name from a registered extension vault. Both the secret name and extension vault name must be provided.

Examples

Example 1

Remove-Secret -Name secretTest -Vault CredMan
Get-Secret -Name secretTest -Vault CredMan

Get-Secret: The secret secretTest was not found.

This example removes the secretTest secret from the CredMan vault. The Get-Secret command verifies that the secret no longer exists in the vault.

Example 2

Get-SecretInfo -Name Secret2 -Vault CredMan | Remove-Secret
Get-Secret -Name Secret2 -Vault CredMan

Get-Secret: The secret Secret2 was not found.

This example removes the Secret2 secret from the CredMan vault. Get-SecretInfo retrieves the information for the secret and sends the result through the pipeline to Remove-Secret. Get-Secret verifies that the secret no longer exists in the vault.

Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-InputObject

Specifies a SecretInformation object that describes a vault secret.

Type:SecretInformation
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-Name

Specifies the name of the secret to remove. Wildcard characters (*) are not permitted.

Type:String
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-Vault

Specifies the name of the vault to remove the secret from. Wildcard characters (*) are not permitted.

Type:String
Position:1
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

String

Microsoft.PowerShell.SecretManagement.SecretInformation

Outputs

None