Detect mass file download from cloud apps (KQL)
Bulk downloading from SharePoint, OneDrive or another connected cloud app is a common exfiltration step, including by departing insiders and compromised accounts. This CloudAppEvents query (Defender for Cloud Apps) counts file-download activities per account, source IP and hour, and flags volumes well above normal user behaviour.
Because it aggregates by account and time, a slow trickle stays quiet while a genuine mass pull stands out.
The query
CloudAppEvents
| where Timestamp > ago(24h)
| where ActionType in ("FileDownloaded", "FileSyncDownloadedFull")
| summarize
Downloads = count(),
Files = dcount(ObjectName),
Apps = make_set(Application, 10),
Countries = make_set(CountryCode, 10)
by AccountDisplayName, AccountObjectId, IPAddress, bin(Timestamp, 1h)
| where Downloads >= 50
| sort by Downloads descLine-by-line explanation
| where ActionType in ("FileDownloaded", "FileSyncDownloadedFull")Keeps download activities, including full sync-client downloads, across the connected cloud apps.
by AccountDisplayName, AccountObjectId, IPAddress, bin(Timestamp, 1h)Aggregates per account, source IP and hour so a burst of downloads becomes one reviewable row.
| where Downloads >= 50Flags accounts exceeding a download threshold in the window; tune it to your users' normal activity.
Required tables and columns
ActionTypeThe cloud activity; FileDownloaded or FileSyncDownloadedFull here.ObjectNameThe file involved; counted distinctly to measure how many files were taken.AccountObjectIdStable identifier of the acting account for reliable grouping.IPAddressSource address of the downloads, to spot an unusual location.
MITRE ATT&CK mapping
- Tactic
- ExfiltrationTA0010
- Technique
- T1567· Exfiltration Over Web Service
Tuning and false positives
- Baseline per-user and per-department download norms; a 50-file threshold suits some tenants but not others.
- Raise priority when Countries or IPAddress is unfamiliar, or when the account was recently flagged by a risky sign-in.
Limitations
- Requires the relevant cloud apps to be connected to Defender for Cloud Apps; unconnected apps produce no events.
- ActionType strings vary by connector; confirm the download action names your tenant emits and extend the list as needed.
Related queries
References
Last reviewed 2026-11-18.