> ## Documentation Index
> Fetch the complete documentation index at: https://zenml.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# HashiCorp Vault Secrets Manager

> How to store secrets in HashiCorp Vault

The HashiCorp Vault secrets manager is a [secrets manager](/component-gallery/secrets-managers) flavor provided with the ZenML `vault` integration that uses [HashiCorp Vault](https://www.vaultproject.io/) to store secrets.

### When to use it

You should use the HashiCorp Vault secrets manager if:

* a component of your stack requires a secret for authentication, or you want to use secrets inside your steps.

* you're already using HashiCorp Vault to store your secrets or want a self-hosted secrets solution.

### How to deploy it

To get started with this secrets manager, you need to either:

* [self-host a Vault server](https://www.vaultproject.io/docs/install)

* [register for the managed HashiCorp Cloud Platform Vault](https://cloud.hashicorp.com/docs/vault)

Once you decided and finished setting up one of the two solutions, you need to enable the [KV Secrets Engine - Version 2](https://www.vaultproject.io/docs/secrets/kv/kv-v2).

### How to use it

To use the Vault secrets manager, we need:

* The ZenML `vault` integration installed. If you haven't done so, run

```
zenml integration install vault  
```

* The Vault server URL and KV Secrets Engine v2 endpoint.

* A client token to authenticate with the Vault server. Follow [this tutorial](https://learn.hashicorp.com/tutorials/vault/tokens?in=vault/tokens) to generate one.

We can then register the secrets manager and use it in our active stack:

```
zenml secrets-manager register  \
    --flavor=vault \
    --url= \
    --token= \
    --mount_point=

# Add the secrets manager to the active stack
zenml stack update -x 
```

You can now [register, update or delete secrets](/component-gallery/secrets-managers#in-the-cli) using the CLI or [fetch secret values inside your steps](/component-gallery/secrets-managers#in-a-zenml-step).

You can use [secret scoping](/component-gallery/secrets-managers#secret-scopes) with the Vault Secrets Manager to manage multiple Secrets Manager namespaces on top of a single Vault service instance.

A concrete example of using the HashiCorp Vault secrets manager can be found [here](https://github.com/zenml-io/zenml/tree/main/examples/cloud%5Fsecrets%5Fmanager).

For more information and a full list of configurable attributes of the HashiCorp Vault secrets manager, check out the [API Docs](https://apidocs.zenml.io/latest/integration%5Fcode%5Fdocs/integrations-vault/#zenml.integrations.vault.secrets%5Fmanager.vault%5Fsecrets%5Fmanager.VaultSecretsManager).
