Hi All,
I’m following the guide here: Azure Active Directory with OIDC Auth Method and External Groups | Vault - HashiCorp Learn
Authentication works correctly when I use user_clam=“email” as specified in the guide.
I would like to use user_claim=“upn”, as not all of our users have an email account.
In Azure AD,
under App Registrations → API Permissions: I’ve given ‘Microsoft Graph’, profile and User.Read permisions.
under Token configuration, I’ve added optional claim upn, for ID, Access and SAML Types - because I didn’t know which one was correct.
I can see in the manifest:
"optionalClaims": {
"idToken": [
{
"name": "upn",
"source": null,
"essential": false,
"additionalProperties": []
},
{
"name": "groups",
"source": null,
"essential": false,
"additionalProperties": []
}
],
"accessToken": [
{
"name": "upn",
"source": null,
"essential": false,
"additionalProperties": []
}
],
"saml2Token": [
{
"name": "upn",
"source": null,
"essential": false,
"additionalProperties": []
}
]
}
I’ve updated the oidc role to use user_claim=“upn”:
vault write auth/oidc/role/${VAULT_LOGIN_ROLE} \
user_claim="upn" \
allowed_redirect_uris="http://localhost:8250/oidc/callback" \
allowed_redirect_uris="${VAULT_ADDR}/ui/vault/auth/oidc/oidc/callback" \
groups_claim="groups" \
policies="kv-reader" \
oidc_scopes="https://graph.microsoft.com/.default"
But when a users attempts to login
vault login -method=oidc
They get an error: claim “upn” not found in token
I’ve enabled verbose_oidc_logging and log_level=Debug, and confirm that the upn field is not returned in the token.
Is there something I am missing?