Keycloak: Map email from Azure AD to auto created Keycloak Users
Aug 28
I have added the Microsoft Active Directory as an identity provider as shown below
and configured the Authentication flow to automatically create the user(s)
Mapper is configured to Map the user to a Role based on the claims
Everything works till this part, Users are getting created/added automatically
However, Email column is empty.
I want to automatically populate the Email, so added the required claims in Azure AD as shown below
and I see the optionally added claims(i.e. preferred_username & upn) in the ID JWToken
I tried to map the Claim to the user profile/attribute as shown below
However the "Email" column is not getting populated or updated any other attributes
What should I do to automatically create the user along with his/her Email populated?
1 answer
Accepted answer · original discussion
Sep 1
the preferred_username claim is a part of the profile scope, do you have it in the list of scopes in your IDP configuration?
e.g.
Scopes list
Also, you may use the standard scope email, then the claim email will be available in Keycloack.
0 question comments
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.