Overview
This guide will show you how to create a JWT Authentication Method, and how to configure env zero to utilize OIDC to authenticate to your vault cluster to retrieve secrets. Refer to env zeroโs OIDC configuration. We are going to follow the Vault documentation on how to create a JWT AuthenticationJWT Authentication Method
- Login to your vault cluster
- In the side navigation bar click on
Access
- Choose
Authentication Methods
in the left side menu - Click on the
Enable new method
button and it will open the Authentication method creation wizard - Choose
JWT
- Expand
Method Options
add a description and the relevant configuration and click on theEnabled Method
button - In the
Configure JWT
page under theJwks url
enterhttps://login.app.env0.com/.well-known/jwks.json
- Expand
JWT Options
and set theBound issuer
to behttps://login.app.env0.com/
- Click on the
Save
button

Configure JWT
Setup Secrets Store and Create Policy
Create a KV store in vault to save and fetch secrets.Create Login Role
To create the role that binds the policy,sub
, aud
and env0 custom claims we will use the vault CLI. Make sure you have it installed on your machine and that you have access to vault. Export the following environment variables:
VAULT_TOKEN
environment variable to authenticate but if you prefer, you can skip it and use vault login
instead.
Now execute the following command to create the role:
More ClaimsIn this example we only set the
aud
, the organizationId
and the apiKeyType
claims, however you can also set any additional claims you would like from the list of claims we support. The list is located hereAuthenticating to Vault with env zero Credential
Go to the organizationโs credentials page and create a new deployment credential. SelectVault OIDC
type and enter the following fields:
Address
- The vault address, including portVersion
- The vault version to useRole Name
- Vault role nameJWT Auth Backend Path
- Path to the new authentication methodNamespace
- Optional, the vault namespace

Authenticating to Vault with Terraform Provider
To configure the vault terraform provider all you need is the vault provider block and theVAULT OIDC
deployment credentials set on the project. Example:
VAULT OIDC
deployment credentials are used to authenticate with the vault server along with the ENV0_OIDC_TOKEN
JWT token which then sets the VAULT_TOKEN
variable with the actual session token that is returned from the vault server used for authentication/authorization.