Email containing malware accessed on a unmanaged device
Description
In this query, we are looking for emails containing malware accessed on a unmanaged device
Query · kql
EmailPostDeliveryEvents | where ActionType == "Malware ZAP" | project NetworkMessageId,InternetMessageId,ActionType,ThreatTypes,DetectionMethods,ZAPReportId=ReportId,ZAPTimestamp=Timestamp | join (CloudAppEvents | where ActionType == "MailItemsAccessed" | extend RawEvent=parse_json(RawEventData) | mv-expand RawEvent.Folders | mv-expand RawEvent_Folders.FolderItems | project SessionId=tostring(RawEvent.SessionId),InternetMessageId=tostring(parse_json(RawEvent_Folders_FolderItems).InternetMessageId),ActionTimestamp=Timestamp,ActionReportId=ReportId ) on InternetMessageId | where isnotempty(SessionId) | join (EntraIdSignInEvents | where isempty(DeviceName) | distinct AccountUpn,SessionId) on SessionId | project AccountUpn,NetworkMessageId,InternetMessageId,ActionType,ThreatTypes,DetectionMethods,SessionId,ReportId=ActionReportId,Timestamp=ActionTimestamp