Query Details
// Detect privilege escalation to The Most Dangerous Entra Admin Role via compromised service principal // https://www.linkedin.com/posts/activity-7223370832763351040-TieO/ // Hourly Sentinel Analytics Rule: let PTS = dynamic(['[email protected]', '[email protected]', '[email protected]']); AuditLogs | where TimeGenerated > ago(1h) | where Category == "RoleManagement" | where ActivityDisplayName == "Add member to role" | where TargetResources contains "Partner Tier2 Support" | extend UPN = tostring(TargetResources[0].userPrincipalName) | where not (UPN has_any(PTS)) // Custom DefenderXDR KQL (Exposure Management) detecting this dangerous role activation: let DangerousAdmin = ExposureGraphNodes | where set_has_element(Categories, "identity") | extend AccountUPN = NodeProperties.rawData.accountUpn | extend AdminRoles = NodeProperties.rawData.assignedRoles | where AdminRoles contains "Partner Tier2 Support" | project AccountUPN; IdentityLogonEvents | where AccountUpn has_any(DangerousAdmin)
This query is designed to detect if a compromised service principal has been used to escalate privileges to a highly sensitive administrative role, specifically the "Partner Tier2 Support" role, within the last hour. Here's a simplified breakdown:
In essence, the query aims to catch unauthorized privilege escalations to a critical admin role by excluding known trusted service principals and focusing on recent activities.

Steven Lim
Released: August 2, 2024
Tables
Keywords
Operators