Skip to content

Incompatibility with Entra ID national cloud for group sync #16180

@rqi14

Description

@rqi14

Describe the bug
The Entra ID (Azure AD) source type has hardcoded Microsoft Graph API endpoints (e.g., https://graph.microsoft.com/v1.0/me). This makes it incompatible with sovereign clouds like Microsoft Cloud for China (operated by 21Vianet), which uses different endpoints (e.g., https://microsoftgraph.chinacloudapi.cn). When configured to use a 21Vianet tenant, the source fails to fetch group memberships, leading to a KeyError during the login flow because the expected raw_groups data is missing.

The cause of the issue is that the graph api endpoint as well as the domain before the scope values is hard coded (https://github.com/goauthentik/authentik/blob/c886e4ff6b644bca7167b40fe2c2062a5438fc59/authentik/sources/oauth/types/entra_id.py#L35C14-L35C58), instead of dynamically retrieved from user profile url. For example, mine is https://microsoftgraph.chinacloudapi.cn/oidc/userinfo and the graph end point is https://microsoftgraph.chinacloudapi.cn/v1.0. The corresponding memberOf api endpoint is https://microsoftgraph.chinacloudapi.cn/v1.0/me/memberOf

As said above, the domain before scopes is also harded coded such as https://graph.microsoft.com/GroupMember.Read.All which means the code won't work given the domain is different for national cloud.

To Reproduce
Steps to reproduce the behavior:

  1. Create a new OAuth Source in authentik and select "Entra ID".
  2. Configure the source to use a tenant hosted in Microsoft Cloud for China (21Vianet).
  3. Set the OIDC discovery endpoint to the 21Vianet equivalent, for example: https://login.partner.microsoftonline.cn/{tenant-id}/v2.0/.well-known/openid-configuration.
  4. Ensure the "Profile URL" is correctly set to https://microsoftgraph.chinacloudapi.cn/v1.0/me
  5. Attempt to log in using this source
  6. Graph API request is unsuccessful. raw_groups is empty

Expected behavior
It should be able to retrieve group infomration from /me/memberOf endpoint

Screenshots
If applicable, add screenshots to help explain your problem.

Logs
Output of docker-compose logs or kubectl logs respectively

Version and Deployment (please complete the following information):

  • authentik version: 2025.6.4
  • Deployment: docker compose

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions