Edit

Share via


Remove-Secret

Removes a secret from a specified registered extension vault.

Syntax

NameParameterSet (Default)

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

InfoParameterSet

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 wasn't 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 wasn't 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.

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-InputObject

Specifies a SecretInformation object that describes a vault secret.

Parameter properties

Type:Microsoft.PowerShell.SecretManagement.SecretInformation
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

InfoParameterSet
Position:0
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-Name

Specifies the name of the secret to remove. Wildcard characters (*) aren't permitted.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

NameParameterSet
Position:0
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-Vault

Specifies the name of the vault to remove the secret from. Wildcard characters (*) aren't permitted.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

NameParameterSet
Position:1
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet isn't run.

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

String

Microsoft.PowerShell.SecretManagement.SecretInformation

Outputs

None