Detection rules › Kusto
Conditional Access - Dynamic Group Exclusion Changes
// Detects changes to Dynamic Membership Rules for specified groups (often used in CA exclusions)
MITRE ATT&CK coverage
| Tactic | Techniques |
|---|---|
| Privilege Escalation |
Telemetry coverage
| Platform | Record / event type |
|---|---|
| Azure | Update group |
Rules detecting the same action
These rules filter on the same operation.
- Detect suspicious conditional access policy modifications (Kusto)
- Detecting Impossible travel with mailbox permission tampering & Privilege Escalation attempt (Kusto)
- Entra ID Successful Group Deletion (YARA-L)
- Guest accounts added in Entra ID Groups other than the ones specified (Kusto)
- User Removed From Group With CA Policy Modification Access (Sigma)
Rule body
id: c385944b-17b9-4b2b-921e-0e8d0341a675
name: Conditional Access - Dynamic Group Exclusion Changes
version: 1.0.1
kind: Scheduled
description: // Detects changes to Dynamic Membership Rules for specified groups (often used in CA exclusions)
severity: High
requiredDataConnectors:
- connectorId: AzureActiveDirectory
dataTypes:
- AuditLogs
queryFrequency: 5m
queryPeriod: 5m
triggerOperator: gt
triggerThreshold: 0
tactics:
- PrivilegeEscalation
relevantTechniques:
- T1484
query: |-
// Detects changes to Dynamic Membership Rules for specified groups (often used in CA exclusions)
let monitoredGroups = dynamic(["Group1", "Group2"]); // <-- Customize this list
AuditLogs
| where OperationName == "Update group"
| where AdditionalDetails[0].value == "DynamicMembership"
| extend DynamicGroupName = tostring(TargetResources[0].displayName)
| where DynamicGroupName in (monitoredGroups)
| extend modifiedBy = tostring(InitiatedBy.user.userPrincipalName)
| extend accountName = tostring(split(modifiedBy, "@")[0])
| extend upnSuffix = tostring(split(modifiedBy, "@")[1])
| extend oldRule = tostring(TargetResources[0].modifiedProperties[0].oldValue)
| extend newRule = tostring(TargetResources[0].modifiedProperties[0].newValue)
| where oldRule != newRule
| project
TimeGenerated,
OperationName,
DynamicGroupName,
modifiedBy,
accountName,
upnSuffix,
result = Result,
oldRule,
newRule
| order by TimeGenerated desc
entityMappings:
- entityType: Account
fieldMappings:
- identifier: Name
columnName: accountName
- identifier: UPNSuffix
columnName: upnSuffix
suppressionEnabled: false
suppressionDuration: 5h
eventGroupingSettings:
aggregationKind: AlertPerResult
incidentConfiguration:
createIncident: true
groupingConfiguration:
enabled: false
reopenClosedIncident: false
lookbackDuration: PT5H
matchingMethod: AllEntities
groupByEntities: []
groupByAlertDetails: []
groupByCustomDetails: []
Stages and Predicates
Parameters
let monitoredGroups = dynamic(["Group1", "Group2"]);
Stage 1: source
AuditLogs
Stage 2: where
| where OperationName == "Update group"
Stage 3: where
| where AdditionalDetails[0].value == "DynamicMembership"
Stage 4: extend
| extend DynamicGroupName = tostring(TargetResources[0].displayName)
Stage 5: where
| where DynamicGroupName in (monitoredGroups)
Stage 6: extend (5 consecutive steps)
| extend modifiedBy = tostring(InitiatedBy.user.userPrincipalName)
| extend accountName = tostring(split(modifiedBy, "@")[0])
| extend upnSuffix = tostring(split(modifiedBy, "@")[1])
| extend oldRule = tostring(TargetResources[0].modifiedProperties[0].oldValue)
| extend newRule = tostring(TargetResources[0].modifiedProperties[0].newValue)
Stage 7: where
| where oldRule != newRule
Stage 8: project
| project
TimeGenerated,
OperationName,
DynamicGroupName,
modifiedBy,
accountName,
upnSuffix,
result = Result,
oldRule,
newRule
Stage 9: sort
| order by TimeGenerated desc
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
DynamicGroupName | in |
| field:"DynamicGroupName" kind:in |
OperationName | eq |
| field:"OperationName" kind:eq value:"Update group" |
oldRule | cross_field_compare |
| field:"oldRule" kind:cross_field_compare value:"newRule" |
value | eq |
| field:"value" kind:eq value:"DynamicMembership" |
Output fields
These fields are emitted when the rule matches.
| Field | Source |
|---|---|
DynamicGroupName | project |
OperationName | project |
TimeGenerated | project |
accountName | project |
modifiedBy | project |
newRule | project |
oldRule | project |
result | project |
upnSuffix | project |