retrieve all flatten group memberships for the user

In my Azure Active Directory (Azure AD) setup, I have a hierarchical group structure where:

Parent Group: parentGrp

Child Group: childGrp

     **User**: `John Doe`
     

When I fetch the user’s group memberships from the token (such as ID token or access token), I only see the child groups (like childGrp) in the group claim. Direct membership to childGrp is reflected, but the parent group (parentGrp) does not appear as part of the user’s group claim.

Objective: I want to retrieve all group memberships for the user, flattening the hierarchy so that both direct and nested groups are included. This means I want to see both:

Groups that the user is directly a member of (like childGrp).

  • Groups higher in the hierarchy (like parentGrp), where the user is an indirect member via nested groups.In my Azure Active Directory (Azure AD) setup, I have a hierarchical group structure where:

    When I fetch the user’s group memberships from the token (such as ID token or access token), I only see the child groups (like childGrp) in the group claim. Direct membership to childGrp is reflected, but the parent group (parentGrp) does not appear as part of the user’s group claim. Objective:
    I want to retrieve all group memberships for the user, flattening the hierarchy so that both direct and nested groups are included. This means I want to see both:

    • Groups that the user is directly a member of (like childGrp).
    • Groups higher in the hierarchy (like parentGrp), where the user is an indirect member via nested groups.

Read more here: Source link