mirror of
https://github.com/open-webui/open-webui.git
synced 2026-06-02 23:08:26 -05:00
[GH-ISSUE #20518] Microsoft Entra ID OAuth role mapping not working - ENABLE_OAUTH_ROLE_MANAGEMENT ignored #73812
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @roller100 on GitHub (Jan 9, 2026).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/20518
Description
When using Microsoft Entra ID OAuth with app roles configured, the
ENABLE_OAUTH_ROLE_MANAGEMENTandOAUTH_ROLES_CLAIMenvironment variables do not work. All users are created withuserrole regardless of their Entra ID app role assignment.Environment
Configuration
Entra ID App Registration:
adminanduseradminrole in Enterprise Applicationrolesclaim in both ID token and access token:Open Web UI Environment Variables:
Expected Behavior
Users with
adminrole assigned in Entra ID Enterprise Application should be created withadminrole in Open Web UI.Actual Behavior
All users are created with
userrole, regardless of their Entra ID app role assignment. Manual database promotion required:Observations
rolesclaim is present in the token (verified via Entra ID token configuration)ENABLE_OAUTH_ROLE_MANAGEMENT=trueappears to have no effect with Microsoft OAuthRelated Discussion
This issue is mentioned in #9275 where other users report the same problem. Quote from @riosengineer:
Proposed Solution
Extend the Microsoft OAuth handler to:
rolesclaim from the ID tokenadmin,user,pending)ENABLE_OAUTH_ROLE_MANAGEMENTfor Microsoft OAuth (currently appears to only work with generic OIDC)Workaround
Manual database update after initial OAuth login:
Additional Context
This is critical for enterprise deployments where role-based access control is managed centrally in Entra ID. Manual promotion doesn't scale and defeats the purpose of SSO integration.
@riosengineer commented on GitHub (Jan 9, 2026):
Hey @roller100 - Just to clarify, my comment is referring to the Entra groups display name claim not being present on the token in Open WebUI, rather than the roles.
I can manage the roles from Entra, and give someone an Administrator role - when they log in they do get an admin role. But the synced Entra groups are the object id/guids and not the display names (same for the profile photo claim too, only works with Microsoft IdP and NOT OAUTH generic claims)
In regards to your problem, is it possible that you are missing this env var?
OAUTH_ALLOWED_ROLESwhich I have two roles as the value:user,admin(you'd need to add one more for your pending state. ?)Edit: Decided to dig out all my Entra/OAuth env vars that do work for roles and sync as of today
@tjbck commented on GitHub (Mar 25, 2026):
Addressed in dev.
@silenceroom commented on GitHub (Apr 12, 2026):
I'm having the same problem that the display name in Groups are object ID instad of the actual group name. To clarify, this happens only on the Group that were sync from local Windows Active Directory, if the groups were a cloud Group, then OWUI can properly display the name.
A group created on local AD and synced to Entra.

A Cloud based group.

@silenceroom commented on GitHub (Apr 12, 2026):
Just figure it out.
In the "Token Configurations" of App Registration, add the group claim, and then make sure the ID is set to "sAMAccountName". This will then ensure the OWUI recognize both cloud/local AD group names.
@riosengineer commented on GitHub (Apr 12, 2026):
Nice. Thanks. When I posted my reply a few months ago there wasn't any claim in the code even if the Entra endpoint had it in there when passing to Open WebUI. Maybe they fixed this now also