PowerShell Plugin
Utilize PowerShell's Secret Management module to access secrets with the Keeper Secrets Manager PowerShell Plugin

Prerequisites

This page documents the Secrets Manager PowerShell integration. In order to utilize this integration, you will need:

About

The Keeper Secrets Manager PowerShell plugin utilizes Microsoft PowerShell's Secret Management module to inject secrets from the Keeper Vault into your PowerShell scripts.
The Keeper Secrets Manager extension can be easily configured added as a secret vault into new or existing PowerShell Secret Management workflows.
For more information about PowerShell Secret Management, see the PowerShell docs on their GitHub page.

Installation

1. Install PowerShell Secret Management Module

Keeper Secrets Manager uses the Microsoft.PowerShell.SecretManagement module to manage secrets in PowerShell.
Install using PowerShell:
1
Install-Module -Name Microsoft.PowerShell.SecretManagement
Copied!
See PowerShell Gallery for other installation options

2. Install Keeper Secrets Manager for PowerShell

Install the Keeper Secrets Manager PowerShell extension from the PowerShell Gallery.
1
Install-Module -Name SecretManagement.Keeper
Copied!
See the PowerShell Gallery page for more installation options, or find the source code in GitHub.
To update SecretManagement, use the command: Update-Module -Name SecretManagement.Keeper

3. Install a PowerShell Secret Management Extension

If you already have a local secrets extension that you would like to use, you can skip this step
The Keeper Secrets Manager PowerShell plugin will need a secret management extension to store the plugin configuration locally to your machine.
SecretStore
KeyChain
1
Install-Module -Name Microsoft.Powershell.SecretStore
Copied!
1
Install-Module -Name SecretManagement.KeyChain
Copied!

4. Register a Vault to use for Configuration Storage

If you already have a local secrets vault registered that you would like to use, you can skip this step
Register a secret vault for the previously installed secret management extension, so that the Keeper Secrets Manager plugin configuration can be stored.
SecretStore
KeyChain
1
Register-SecretVault -Name LocalStore `
2
-ModuleName Microsoft.Powershell.SecretStore
Copied!
1
Register-SecretVault -Name LocalStore `
2
-ModuleName SecretManagement.KeyChain
Copied!
The name of this vault will be used to register the Keeper extension. We used LocalStore in this example.
The Secret Management extension that you use for local storage may ask you to create a password for securely accessing the local vault.
Depending on your system settings, you may need to allow PowerShell to trust external modules. To do this, run the command:
set-executionpolicy remotesigned

5. Register the Keeper Vault

Register the Keeper Secrets Manager Vault using the local vault registered above to save your credentials, and a one time token to connect to Keeper.
Replace 'XXX' below with a one time token.
1
Register-KeeperVault -Name Keeper `
2
-LocalVaultName LocalStore `
3
-OneTimeToken XXX
Copied!

6. Set Keeper Vault as Default Secret Storage (Optional)

Set the Keeper vault you just added as the default secret storage. This will tell the PowerShell SecretsManagement module to use your Keeper vault when getting and setting secrets.
1
Set-SecretVaultDefault keeper
Copied!
This step is optional, but if you choose not to do it, you may receive secrets from your default vault if they have the same name, and you will need to add -Vault <keeper vault name> (e.g. -Vault keeper ) to Set-Secret commands
The Keeper Secrets Manager PowerShell Plugin is now ready to be used

Usage

Find descriptions and examples of the most common usage of the Keeper Secrets Manager PowerShell plugin below.
For more information about PowerShell Secret Management commands, see the PowerShell docs on their GitHub page.

Listing Secrets

Run the following PowerShell command to see a list of secrets from Keeper
Command
Example
1
Get-SecretInfo -Vault <KEEPER VAULT NAME>
Copied!
1
PS> Get-SecretInfo -Vault Keeper
2
3
Name Type VaultName
4
---- ---- ---------
5
bf3dg-99-Juh3feswgtFxg Home SSH Hashtable Keeper
6
_3zT0HvBtRdYzKTMw1IySA ACME Login Hashtable Keeper
Copied!
Use the name set for your Keeper secrets vault, in the examples above we use Keeper.
The secrets shown are any records shared with the Secrets Manager Application. The Name column displays each record's UID and title.

Getting a Single Secret

Get information and values of a single secret
Command
Example
1
Get-Secret <RECORD NAME or UID> -AsPlainText
Copied!
1
PS> Get-Secret "ACME Login" -AsPlainText
2
3
Name Value
4
---- -----
5
login user2
6
password 123
7
Files {file1.json, file2.zip}
Copied!
Wrap the record name in quotation marks when there is a space in it.
-AsPlainText Shows the actual values of the secrets. Otherwise PowerShell shows them as a SecureString

Get a Value From a Secret

Utilize Keeper Dot Notation to identify a field to access. Note that you do not need the 'keeper://' prefix.
Command
Example
1
Get-Secret <RECORD NAME OR UID>.<FIELD> -AsPlainText
Copied!
1
PS> Get-Secret "ACME Login.password" -AsPlainText
Copied!

Set a Value to a Secret

Update the value of a single secret field
Command
Example
1
Set-Secret <RECORD NAME OR UID>.<FIELD> <VALUE TO SET>
Copied!
If the Keeper vault is not set as the default secret vault add
-Vault <keeper vault name> to the command

Keeper Vault is set as Default Vault

1
PS> Set-Secret "ACME Login.url" "acme.com"
Copied!

Keeper Vault is not Default Vault

1
PS> Set-Secret "ACME Login.url" "acme.com" -Vault keeper
Copied!

Download a File

Use dot notation to specify a file attached to a secret in the Keeper vault. Then pass that file to the Set-Content command to download it.
Command
Example
1
Get-Secret <RECORD NAME OR UID>.files[<FILENAME>] `
2
| Set-Content -Path <FILE PATH> -AsByteStream
Copied!
1
PS> Get-Secret my_record.files[file1.json] `
2
| Set-Content -Path ./file1.json -AsByteStream
Copied!
The specified file will be downloaded to the path location given to Set-Content
Last modified 10d ago