Query Details
# Group Membership Report ## Query Information #### Description This query can be used to draw an report of the Entra ID group memberships of all users. Note: if a users has more than 1000 memberships remove the 1000 limitation in the make_set to display all groupnames. ## Defender XDR ```KQL let TimeFrame = 30d; IdentityInfo | where Timestamp > ago(TimeFrame) | summarize arg_max(TimeGenerated, *) by AccountObjectId | mv-expand GroupMembership | where isnotempty(GroupMembership) | summarize TotalMemberships = dcount(tostring(GroupMembership)), MemberOf = make_set(tostring(GroupMembership), 1000) by AccountObjectId, AccountDisplayName, AccountUPN | extend ReportDate = now() ``` ## Sentinel ```KQL let TimeFrame = 30d; IdentityInfo | where TimeGenerated > ago(TimeFrame) | summarize arg_max(TimeGenerated, *) by AccountObjectId | mv-expand GroupMembership | where isnotempty(GroupMembership) | summarize TotalMemberships = dcount(tostring(GroupMembership)), MemberOf = make_set(tostring(GroupMembership), 1000) by AccountObjectId, AccountDisplayName, AccountUPN | extend ReportDate = now() ```
This query generates a report of group memberships for all users in Entra ID (formerly Azure AD) over the past 30 days. Here's a simplified breakdown of what the query does:
The result is a report that shows each user's total group memberships and a list of the groups they belong to, along with the date the report was generated.

Bert-Jan Pals
Released: August 25, 2024
Tables
Keywords
Operators