Authenticating Azure users with Hashicorp Vault
Hashicorp released Vault 0.10.4 yesterday and one of the new features is a plugin to support JWT/OIDC as an auth method. Azure has an OIDC endpoint that you can use to authenticate against and if you are logged in with the Azure CLI tools you can easily get an access token with az account get-access-token
. Here’s how to get it working.
First thing is to ensure you are running vault 0.10.4. Then enable the jwt auth method.
Then configure the JWT endpoint. Be sure to replace {tenant_id}
with your Azure tenant ID.
Configure a role to log in as. The “audience” is dictated by what is provided by the Azure CLI. The “upn” claim is used by Vault to calculate an identity and Microsoft claim it stores the User Principal Name of the authenticating user.
And that’s it! In this example below, I get a vault token using the role created above and extract the token from the Azure CLI’s output using jq.