Register-SecretVault

Registers a SecretManagement extension vault module for the current user.

Syntax

Register-SecretVault
        [-ModuleName] <String>
        [[-Name] <String>]
        [-VaultParameters <Hashtable>]
        [-DefaultVault]
        [-AllowClobber]
        [-PassThru]
        [-Description <String>]
        [-WhatIf]
        [-Confirm]
        [<CommonParameters>]

Description

This cmdlet adds a SecretManagement extension vault to the current user's vault registry. An extension vault is a PowerShell module that conforms to the required extension vault format. This cmdlet verifies that the specified module meets conformance requirements before adding it to the extension vault registry. Extension vaults are registered to the current user and do not affect other user vault registrations.

The first vault registered with this cmdlet is automatically defined as the default vault even if the DefaultVault parameter is not specified.

Examples

Example 1

Register-SecretVault -Name LocalStore -ModuleName Microsoft.PowerShell.SecretStore -DefaultVault
Get-SecretVault

VaultName  ModuleName                        IsDefaultVault
---------  ----------                        --------------
CredMan    Microsoft.PowerShell.CredManStore False
LocalStore Microsoft.PowerShell.SecretStore  True

This example registers a Microsoft.PowerShell.SecretStore extension vault for the current user. It uses the DefaultVault parameter to make the registered vault the default vault for the user. Get-SecretVault lists all registered vaults for the user, verifying the vault was registered and set as the default vault.

Example 2

$parameters = @{
    Name = 'Azure'
    ModuleName = 'Az.KeyVault'
    VaultParameters = @{
        AZKVaultName = 'AzureKeyVault'
        SubscriptionId = (Get-AzContext).Subscription.Id
    }
    DefaultVault = $true
}
Register-SecretVault @parameters
Get-SecretVault

Name  ModuleName  IsDefaultVault
----  ----------  --------------
Azure Az.KeyVault True

This example registers an Az.KeyVault extension vault for the current user. The Az.KeyVault module needs to be installed on prior. For the VaultParameters:

  • AZKVaultName specifies the name of the Key Vault on Azure
  • SubscriptionId specifies the ID of the subscription where the Key Vault is created in

Parameters

-AllowClobber

If specified, allows the cmdlet to overwrite an existing registered extension vault with the same name.

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

-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

-DefaultVault

If specified, sets the new extension vault as the default vault for the current user.

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

-Description

Describes the vault. This value is included in the vault registry information.

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

-ModuleName

Specifies the name of the PowerShell module that implements the extension vault. Enter the name of a module or the path to the module. If you specify a name, PowerShell searches for it in the known module paths. If you specify a path, PowerShell searches that path for the module.

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

-Name

Specifies the name of the extension vault. If no name is specified, the module name is used as the vault name.

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

-PassThru

Indicates that the cmdlet should return the SecretVaultInfo object for the successfully registered extension vault. By default this cmdlet does not return any output.

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

-VaultParameters

Specifies a Hashtable object containing optional key-value pairs used as parameters by the extension vault. These parameters are optional. Consult the documentation of the vault extension module to see what values are required.

Type:Hashtable
Position:Named
Default value:None
Required:False
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

None

Outputs

None