← Sentinel query library

Identity governance · Microsoft Sentinel

Find bursts of group membership changes by one actor

Count distinct successful membership audit events per actor and 15-minute window, preserving raw target samples for group and member resolution.

Before you run

Data & scope

Required tables
AuditLogs
Time window
24 hours, grouped into 15-minute windows
  • Microsoft Entra ID connector with AuditLogs collected throughout the stated lookback and access to audit payloads.
  • Any Microsoft Entra ID license supports audit ingestion; workspace query permissions and appropriate directory evidence access are required.

Documentation review by Codex (AI). No live-tenant execution or detection-performance claim. Validate schema, data coverage and expected results in your workspace.

Kusto Query Language
Download .kql
// Hunting starter. Documentation checked 2026-11-13; not tenant-tested.
let minimumChanges = 20;
AuditLogs
| where TimeGenerated >= ago(1d) and TimeGenerated <= now()
| extend AuditOperation = coalesce(ActivityDisplayName, OperationName)
| where AuditOperation in~ ("Add member to group", "Remove member from group")
| where Result =~ "success" and isnotempty(AADTenantId) and isnotempty(Id)
| summarize arg_max(TimeGenerated, *) by AADTenantId, Id
| extend ActorObjectId = coalesce(tostring(InitiatedBy.user.id),
        tostring(InitiatedBy.app.servicePrincipalId)),
    ActorKind = iff(isnotempty(tostring(InitiatedBy.user.id)), "User", "Application"),
    ActorName = coalesce(tostring(InitiatedBy.user.userPrincipalName),
        tostring(InitiatedBy.app.displayName))
| where isnotempty(ActorObjectId)
| summarize ChangeEvents = count(),
    Additions = countif(AuditOperation =~ "Add member to group"),
    Removals = countif(AuditOperation =~ "Remove member from group"),
    FirstSeen = min(TimeGenerated), LastSeen = max(TimeGenerated),
    ActorNames = make_set(ActorName, 3), AuditSamples = make_set(Id, 10),
    TargetSamples = make_set(tostring(TargetResources), 5)
    by AADTenantId, ActorObjectId, ActorKind, WindowStart = bin(TimeGenerated, 15m)
| where ChangeEvents >= minimumChanges
| order by ChangeEvents desc, LastSeen desc
| take 200

Read-only query. Run in your own authorized workspace after checking prerequisites.

A concentrated series of group membership changes can alter access to documents, applications or administrative roles. This hunt finds actors making at least twenty successful membership changes in a 15-minute window. It is an activity-burst view across groups, not a claim that twenty privileged members were added to one group.

Count audit events before expanding targets

The query selects exact add/remove membership operations and deduplicates by directory and audit ID, retaining the latest collected row for each event. It then counts events by stable initiating object ID and actor kind. This avoids multiplying the count merely because one audit event contains multiple target objects. arg_max semantics.

TargetSamples preserves a small set of raw payloads. The query does not guess a group ID from the first target or assume that every target describes a member. Resolve affected groups and members from the original events using their operation-specific payloads. Target-resource contract.

Rows without an actor ID or audit ID are excluded rather than merged into a fictitious common actor. Investigate missing identity coverage separately. The threshold is illustrative and requires tuning to your directory’s normal provisioning behavior.

Review the access impact

Compare the burst with onboarding, offboarding, access reviews, bulk repair and synchronization activity. Determine whether the affected groups actually grant access to the sensitive application or retrieval corpus being investigated. Group names alone do not prove effective privilege.

Separate additions from removals. A large approved removal can reduce exposure but still disrupt operations, while a small unauthorized addition to one sensitive group can matter more than a large benign burst. This threshold hunt is therefore complementary to targeted monitoring of critical groups.

Validate the boundaries

Test twenty unique events, duplicate deliveries of one event, two different actors, an event without an actor ID, and activity on both sides of a bin boundary. Confirm that duplicate events do not inflate ChangeEvents. Fixed windows can split a burst, and slow changes can evade this threshold.

This documentation-checked query has not been executed in a tenant. Its audit operation list does not cover every eligibility, dynamic-membership or indirect access route. The latest raw events, approved change records and resource-specific authorization evidence are needed before deciding whether the observed burst was harmful.

Verify the source

Microsoft references

  1. Microsoft Learn — AuditLogs table schema ↗
  2. Microsoft Learn — Microsoft Entra audit activities ↗
  3. Microsoft Learn — Target resource contract ↗
  4. Microsoft Learn — Kusto arg_max aggregation ↗
Before turning a hunt into an alert

Measure normal activity, validate known test cases, account for ingestion delays, choose a threshold and entity mapping, and assign an owner. Results require investigation.

Follow the detection learning path →