Query Details
//When a user holding a privileged role triggers an Azure AD risk event, retrieve the operations completed by that user
//Lookup the IdentityInfo table for any users holding a privileged role
//Data connector required for this query - Azure Active Directory - Audit Logs
//Data connector required for this query - Microsoft Sentinel UEBA
let privusers=
IdentityInfo
| where TimeGenerated > ago(21d)
| summarize arg_max(TimeGenerated, *) by AccountUPN
| where isnotempty(AssignedRoles)
| where AssignedRoles != "[]"
| distinct AccountUPN;
AADUserRiskEvents
| where TimeGenerated > ago (7d)
| where UserPrincipalName in (privusers)
| where RiskDetail != "aiConfirmedSigninSafe"
| project RiskTime=TimeGenerated, UserPrincipalName
| join kind=inner
(
AuditLogs
| where TimeGenerated > ago(7d)
| extend UserPrincipalName = tostring(parse_json(tostring(InitiatedBy.user)).userPrincipalName)
)
on UserPrincipalName
| project-rename OperationTime=TimeGenerated
| project
RiskTime,
OperationTime,
['Time Between Events']=datetime_diff("minute", OperationTime, RiskTime),
OperationName,
Category,
CorrelationIdThis query retrieves the operations completed by a user holding a privileged role when they trigger an Azure AD risk event. It looks up the IdentityInfo table to find users with privileged roles, then filters the AADUserRiskEvents table to only include events triggered by those users. It also filters out events with a specific risk detail. The query then joins the filtered AADUserRiskEvents table with the AuditLogs table to get additional information about the operations. The final result includes the risk time, operation time, time between events, operation name, category, and correlation ID.

Matt Zorich
Released: June 17, 2022
Tables
Keywords
Operators