Query Details
//Query is from CISA Playbook https://www.cisa.gov/sites/default/files/2025-01/microsoft-expanded-cloud-logs-implementation-playbook-508c.pdf
let keywords = dynamic(['secret','password','vpn']); //replace with orgspecific keywords or remove
let utc_working_hours = range(2,13); //replace with org specific working hours
CloudAppEvents
| extend client_ip = tostring(RawEventData.ClientIP)
| extend query_text = tostring(RawEventData.QueryText)
| where ActionType == "SearchQueryInitiatedExchange" or ActionType ==
"SearchQueryInitiatedSharePoint"
| where not (datetime_part("Hour",Timestamp) in (utc_working_hours))
| where query_text has_any (keywords)
| take 100
| summarize search_number=count(), make_set(query_text), make_set(client_ip)
by AccountDisplayName
This query is designed to analyze cloud application events, specifically focusing on search queries initiated in Exchange or SharePoint. Here's a simplified breakdown of what the query does:
Define Keywords and Working Hours:
secret, password, vpn) that are of interest. These can be customized to fit the organization's needs.Extract and Filter Data:
ClientIP and QueryText from the raw event data for further analysis.Keyword Matching:
Limit and Summarize Results:
In essence, this query helps identify potentially suspicious search activities involving sensitive keywords that occur outside of normal working hours, which could indicate unauthorized access or data leakage attempts.

Jay Kerai
Released: January 20, 2025
Tables
Keywords
Operators