Query Details
// KQL to check Privilege Admin failing Microsoft CA MFA enforcement let PrivilegeAdmin = IdentityInfo | where TimeGenerated > ago(14d) | where AssignedRoles != "[]" and isnotnull(AssignedRoles) | distinct AccountUPN; SigninLogs | where UserPrincipalName has_any(PrivilegeAdmin) | where ResultType == "0" | where ConditionalAccessPolicies != "[]" | mv-expand ConditionalAccessPolicies | extend CADisplayName = tostring(ConditionalAccessPolicies.displayName) | extend CAResult = tostring(ConditionalAccessPolicies.result) | where CADisplayName == "Microsoft-managed: Multifactor authentication for admins accessing Microsoft Admin Portals" | where CAResult == "reportOnlyFailure"
This KQL query is designed to identify privileged admin accounts that have failed to comply with a specific Microsoft Conditional Access (CA) policy related to Multi-Factor Authentication (MFA) enforcement. Here's a simplified breakdown:
Identify Privileged Admin Accounts:
IdentityInfo table to find accounts that have been assigned any roles in the past 14 days.AssignedRoles field is not null.Check Sign-in Logs for MFA Enforcement Failures:
SigninLogs table for sign-in attempts by these privileged admin accounts.ResultType == "0").ConditionalAccessPolicies array to examine each policy individually.In summary, this query identifies privileged admin accounts that have successfully signed in but failed to meet the MFA requirements enforced by a specific Microsoft Conditional Access policy within the last 14 days.

Steven Lim
Released: August 20, 2024
Tables
Keywords
Operators