Query Details
//Query is from CISA Playbook https://www.cisa.gov/sites/default/files/2025-01/microsoft-expanded-cloud-logs-implementation-playbook-508c.pdf //Get sessions associated with suspicious IP address let bad_sessions = materialize ( AADSignInEventsBeta | where IPAddress == 'x.x.x.x’ //Replace with IP of interest | where isempty(SessionId) == false | distinct SessionId ); //Get any mail accessed during suspicious sessions CloudAppEvents | where ActionType == 'MailItemsAccessed' | where RawEventData.SessionId has_any (bad_sessions)
This query is designed to identify suspicious activity related to a specific IP address and any mail accessed during those sessions. Here's a simplified breakdown:
Identify Suspicious Sessions:
AADSignInEventsBeta) to find sessions associated with a specific IP address (x.x.x.x).SessionId is empty, ensuring only valid sessions are considered.SessionId) that are associated with this suspicious IP address. This list is stored in a temporary table called bad_sessions.Find Mail Accessed in Those Sessions:
CloudAppEvents) to find instances where mail items were accessed.bad_sessions list.In summary, this query helps track down any mail accessed during sessions that were initiated from a suspicious IP address, potentially indicating unauthorized or malicious activity.

Jay Kerai
Released: January 20, 2025
Tables
Keywords
Operators