Listen to this Post
Introduction
Kusto Query Language (KQL) is a powerful tool for analyzing security data in Microsoft Defender and Entra ID. In this article, we explore advanced KQL functions and hunting queries to classify and monitor privileged identities, aligning with the Enterprise Access Model for tiered administration.
Learning Objectives
- Learn how to classify Entra ID privileges using KQL functions.
- Automate identity governance with the EntraOps community project.
- Detect sensitive permissions and privilege escalation risks.
1. Classifying Privileged Identities with KQL
Verified KQL Function: `PrivilegedIdentityInfo`
PrivilegedIdentityInfo | where Timestamp > ago(30d) | summarize TotalPrivileges = count() by IdentityName, PrivilegeTier
Step-by-Step Guide:
- Use this function to extract role assignments from Entra ID.
- Filters identities by tier (T0-T2) based on Microsoft’s tiered administration model.
- Outputs a summary of privileges per identity for audit purposes.
2. Analyzing Workload Identities
Verified KQL Function: `WorkloadIdentityInfoXdr`
WorkloadIdentityInfoXdr | where IsHighRisk == true | project WorkloadName, Permissions, LastAccessTime
Step-by-Step Guide:
- Identifies service principals and managed identities with excessive permissions.
2. Flags high-risk workloads (e.g., those with `Directory.ReadWrite.All`).
3. Export results to CSV for further investigation.
3. Hunting for Sensitive Graph Permissions
Verified Hunting Query: `SensitiveMicrosoftGraphDelegatedPermissionAccess`
SensitiveMicrosoftGraphDelegatedPermissionAccess | where Permission contains "Mail.ReadWrite" or Permission contains "User.ReadWrite.All" | join (IdentityInfo) on $left.IdentityId == $right.IdentityId
Step-by-Step Guide:
- Run this query to detect delegated OAuth permissions in Entra ID.
- Correlate with `IdentityInfo` to pinpoint risky user/service accounts.
3. Mitigate by revoking unnecessary permissions.
4. Monitoring Privilege Escalation
Verified Query: `RecentAddedPrivileges`
RecentAddedPrivileges | where TimeAdded > ago(7d) | sort by TimeAdded desc
Step-by-Step Guide:
1. Tracks new role assignments in near real-time.
- Alerts on unexpected additions (e.g., Global Admin assignments).
- Integrate with Azure Logic Apps for automated remediation.
5. Automating EntraOps Classifications
Resource: EntraOps Project
Steps to Implement:
- Download classification files from the EntraOps GitHub.
- Ingest data into Microsoft Sentinel for continuous monitoring.
- Use KQL to map identities to tiers (T0=Critical, T1=High, T2=Standard).
What Undercode Say
Key Takeaways:
- Proactive Governance: KQL enables real-time privilege monitoring, reducing attack surfaces.
- Automation Potential: EntraOps simplifies tiered administration at scale.
- Risk Prioritization: Focus on T0 identities first to protect critical assets.
Analysis:
The integration of KQL with Entra ID transforms reactive IAM into a proactive security strategy. By classifying privileges and automating detection, organizations can enforce least-privilege principles and respond to threats faster. As cloud environments grow, tools like EntraOps and KQL will become indispensable for identity-centric security.
Prediction
By 2025, 70% of cloud breaches will stem from misconfigured identities. Adopting KQL-based identity analytics will be a cornerstone of Zero Trust architectures, with Microsoft’s ecosystem leading the charge in scalable privilege management.
For deeper insights, watch Thomas Naunheim’s KQL Café session.
IT/Security Reporter URL:
Reported By: Activity 7346406425348255745 – Hackers Feeds
Extra Hub: Undercode MoN
Basic Verification: Pass ✅