Azure Key Vault

Sync secrets from the Keeper Vault with Azure Key Vault


The Keeper Secrets Manager CLI tool sync command allows you to push secrets from the Keeper Vault to a target Azure Key Vault account, overwriting the existing values in the target location. This allows the Keeper Vault to be the single source of truth for any services or scripts in Azure which utilize the Key Vault.


  • Use secrets from the Keeper Vault as the source of truth for Azure Key Vault

  • Seamlessly start using secrets from the Keeper Vault with your existing Azure scripts and services


  • Keeper Secrets Manager access (See the Quick Start Guide for more details)

    • Secrets Manager add-on enabled for your Keeper account

    • Membership in a Role with the Secrets Manager enforcement policy enabled

  • A Keeper Secrets Manager Application with secrets shared to it

  • An Azure account with Key Vault, and the ability to create security principals


1. Configure Keeper Secrets Manager CLI

You can skip this step if the KSM CLI is already configured on your machine.

To configure the KSM CLI tool, a profile needs to be created with the Keeper Secrets Manager One Time Access Token.

The simplest way to do this is to initialize the default profile with the following command:

ksm profile init <TOKEN>

For information on creating multiple profiles and other options, see the profile documentation

2. Set Azure Permissions

To use KSM sync with Azure, the Azure account needs to be configured to accept the connection. The Azure account with Key vault needs to enable a service principal with authorization to perform key operations in the Key Vault.

Follow the Microsoft guide for setting up a service principal:

3. Create Azure Credentials Record

The KSM CLI needs the credentials for the Azure account to set secrets. These credentials are stored in a Keeper record which the CLI tool can access using Keeper Secrets Manager.

Record fields with the following labels are required on the credentials record:

"Azure Tenant ID" "Azure Client ID" "Azure Client Secret" "Azure Key Vault Name"

When retrieving the Client secret from Azure app registration, make sure to copy the Value (not Secret ID) into "Azure Client Secret" field.

(Method 1) Create an Azure Credentials Custom Record Type

A custom record type can be created with the required fields, which makes it easy and clean to create a record.

To create a custom record type, go to the "Custom Record Types" tab in the Keeper Vault and hit "Create Type". Create a new record type with hidden fields that have the correct field label, then click "Publish" to create the new record type.

Then simply create a new record of the Azure Credentials type and enter the details into the corresponding fields.

Make sure this new record is in a shared folder that is shared to your Secrets Manager application.

(Method 2) Add Custom Fields

To create a credentials record without creating a new record type, the required fields can be added as custom fields to a standard record.

Create a new record of any type, then add Custom Fields of the 'Hidden Field' type for each required Azure field. Click "Edit Label" to change the labels to the corresponding field name.

Any record type will work, but the "File Attachment" standard record type has no fields and will be cleaner looking when custom fields are added

Then fill in each custom field and hit "Save" to save the record.

4. Create Value Mappings

The KSM CLI sync command identifies which values to set using mappings that are defined on the command call. For each mapping passed to the command, a value with the given name will be populated with the given value from the Keeper Vault.

These mappings follow this format:


VALUE KEY is the key name that the value will be assigned in Azure Key Vault

KEEPER NOTATION is a Keeper notation query of a value from a keeper record to set to the key

Keeper notation is a query notation used by Keeper Secrets Manager to identify specific record values. The notation follows the general format of: UID/[field|custom_field]/fieldname for example: ae3d[...]d22e/field/password

See the Keeper Notation documentation for more information

Note that full record UIDs are not given in these examples

Full Mapping Example: --map "MySQL_PWD" "jd3[...]i-fd/field/password"

Multiple mappings can be added to a single sync command --map "MySQL_PWD" "jd3[...]i-fd/field/password" --map "MySQL_Login" "jd3[...]i-fd/field/login"

Ensure that the records referenced by the Keeper Notation queries are in a shared folder that is shared with your Secrets Manager application

KSM sync is now ready to run

Run Sync

To run the sync, use the KSM CLI sync command with the credentials record and value mapping

1. Construct the Command

Put together the KSM sync command with the Azure type. The format looks like the following:

ksm sync --type azure --credentials [UID] --map [...] --map [...]

2. Run a Dry-Run

The sync command supports running a dry-run which will identify all changes that will be made to your Azure Key Vault values without actually pushing the values or making changes. Use this to make sure your mapping queries are constructed properly.

ksm sync --type azure --credentials [UID] --map [...] --map [...] --dry-run

3. Run the Sync

When ready, run the sync command without the dry-run option. This will push values from your Keeper Vault to Azure Key Vault

TIP: you can use -m as short hand for --map

ksm sync --type azure --credentials [UID] -m [...] -m [...]

Last updated