← Back to SOC feed Coverage →

MDO Threat Protection Detections trend over time

kql MEDIUM Azure-Sentinel
T1566
CloudAppEventsEmailEvents
huntingmicrosoftofficial
This rule was pulled from an open-source repository and enriched with AI. Validate in a test environment before deploying to production.
View original rule at Azure-Sentinel →
Retrieved: 2026-05-10T23:00:00Z · Confidence: medium

Hunt Hypothesis

Adversaries may be using malware delivery obfuscation techniques to evade detection, as indicated by the trend in MDO threat protection detections. SOC teams should proactively hunt for this behavior to identify and mitigate potential advanced persistent threats leveraging evasion tactics in their Azure Sentinel environment.

KQL Query

let TimeStart = startofday(ago(30d));
let TimeEnd = startofday(now());
let totalinbound = EmailEvents
| where Timestamp >= TimeStart
| where EmailDirection == "Inbound"
| make-series Count= count() on Timestamp from TimeStart to TimeEnd step 1d
| extend Details = "Total Inbound Emails";
let totalintraorg = EmailEvents
| where Timestamp >= TimeStart
| where EmailDirection == "Intra-org"
| make-series Count= count() on Timestamp from TimeStart to TimeEnd step 1d
| extend Details = "Total Intra-org Emails";
let totaloutbound = EmailEvents
| where Timestamp >= TimeStart
| where EmailDirection == "Outbound"
| make-series Count= count() on Timestamp from TimeStart to TimeEnd step 1d
| extend Details = "Total Outbound Emails";
let totalwiththreat = EmailEvents
| where Timestamp >= TimeStart
| where isnotempty(ThreatTypes)
| make-series Count= count() on Timestamp from TimeStart to TimeEnd step 1d
| extend Details = "Total Emails with Threat";
let phishingcount = EmailEvents
| where Timestamp >= TimeStart
| where ThreatTypes has ('Phish')
| make-series Count= count() on Timestamp from TimeStart to TimeEnd step 1d
| extend Details = "Emails Detected as Phish";
let malwarecount = EmailEvents
| where Timestamp >= TimeStart
| where ThreatTypes has ('Malware')
| make-series Count= count() on Timestamp from TimeStart to TimeEnd step 1d
| extend Details = "Emails Detected as Malware";
let spamcount = EmailEvents
| where Timestamp >= TimeStart
| where ThreatTypes has ('Spam')
| make-series Count= count() on Timestamp from TimeStart to TimeEnd step 1d
| extend Details = "Emails Detected as Spam";
let zapcount = EmailPostDeliveryEvents
| where Timestamp >= TimeStart
| where ActionResult == "Success"
| where ActionType == "Phish ZAP" or ActionType == "Malware ZAP"
| make-series Count= count() on Timestamp from TimeStart to TimeEnd step 1d
| extend Details = "Total Emails Removed by ZAP";
let usersubmissioncount = CloudAppEvents
| where Timestamp >= TimeStart
| extend Record= (parse_json(RawEventData)).RecordType
| extend SubmissionState = (parse_json(RawEventData)).SubmissionState
| where Record == 29 | where ActionType == "UserSubmission"
| make-series Count= count() on Timestamp from TimeStart to TimeEnd step 1d
| extend Details = "Total Emails Reported by Users";
let adminsubmissioncount = CloudAppEvents
| where Timestamp >= TimeStart
| extend Record= (parse_json(RawEventData)).RecordType
| extend SubmissionState = (parse_json(RawEventData)).SubmissionState
| where Record == 29
| where ActionType == "AdminSubmission"
| make-series Count= count() on Timestamp from TimeStart to TimeEnd step 1d
| extend Details = "Total Emails Reported by Admins";
union totalinbound, totalintraorg, totaloutbound, totalwiththreat, phishingcount, malwarecount, spamcount, zapcount,  usersubmissioncount, adminsubmissioncount
| project Count, Details, Timestamp
| render timechart

Analytic Rule Definition

id: 02698387-5bf0-4111-a6ca-0f592a238a8f
name: MDO Threat Protection Detections trend over time
description: |
  Graph of MDO detections trended over time
description-detailed: |
  Graph of MDO detections trended over time in Defender for Office 365
  Query is also included as part of the Defender for Office 365 solution in Sentinel: https://techcommunity.microsoft.com/blog/microsoftdefenderforoffice365blog/part-2-build-custom-email-security-reports-and-dashboards-with-workbooks-in-micr/4411303
requiredDataConnectors:
- connectorId: MicrosoftThreatProtection
  dataTypes:
  - EmailEvents
  - CloudAppEvents
  - EmailPostDeliveryEvents
tactics:
  - InitialAccess
relevantTechniques:
  - T1566
query: |
  let TimeStart = startofday(ago(30d));
  let TimeEnd = startofday(now());
  let totalinbound = EmailEvents
  | where Timestamp >= TimeStart
  | where EmailDirection == "Inbound"
  | make-series Count= count() on Timestamp from TimeStart to TimeEnd step 1d
  | extend Details = "Total Inbound Emails";
  let totalintraorg = EmailEvents
  | where Timestamp >= TimeStart
  | where EmailDirection == "Intra-org"
  | make-series Count= count() on Timestamp from TimeStart to TimeEnd step 1d
  | extend Details = "Total Intra-org Emails";
  let totaloutbound = EmailEvents
  | where Timestamp >= TimeStart
  | where EmailDirection == "Outbound"
  | make-series Count= count() on Timestamp from TimeStart to TimeEnd step 1d
  | extend Details = "Total Outbound Emails";
  let totalwiththreat = EmailEvents
  | where Timestamp >= TimeStart
  | where isnotempty(ThreatTypes)
  | make-series Count= count() on Timestamp from TimeStart to TimeEnd step 1d
  | extend Details = "Total Emails with Threat";
  let phishingcount = EmailEvents
  | where Timestamp >= TimeStart
  | where ThreatTypes has ('Phish')
  | make-series Count= count() on Timestamp from TimeStart to TimeEnd step 1d
  | extend Details = "Emails Detected as Phish";
  let malwarecount = EmailEvents
  | where Timestamp >= TimeStart
  | where ThreatTypes has ('Malware')
  | make-series Count= count() on Timestamp from TimeStart to TimeEnd step 1d
  | extend Details = "Emails Detected as Malware";
  let spamcount = EmailEvents
  | where Timestamp >= TimeStart
  | where ThreatTypes has ('Spam')
  | make-series Count= count() on Timestamp from TimeStart to TimeEnd step 1d
  | extend Details = "Emails Detected as Spam";
  let zapcount = EmailPostDeliveryEvents
  | where Timestamp >= TimeStart
  | where ActionResult == "Success"
  | where ActionType == "Phish ZAP" or ActionType == "Malware ZAP"
  | make-series Count= count() on Timestamp from TimeStart to TimeEnd step 1d
  | extend Details = "Total Emails Removed by ZAP";
  let usersubmissioncount = CloudAppEvents
  | where Timestamp >= TimeStart
  | extend Record= (parse_json(RawEventData)).RecordType
  | extend SubmissionState = (parse_json(RawEventData)).SubmissionState
  | where Record == 29 | where ActionType == "UserSubmission"
  | make-series Count= count() on Time

Required Data Sources

Sentinel TableNotes
CloudAppEventsEnsure this data connector is enabled
EmailEventsEnsure this data connector is enabled

MITRE ATT&CK Context

References

False Positive Guidance

Original source: https://github.com/Azure/Azure-Sentinel/blob/main/Hunting Queries/Microsoft 365 Defender/Email and Collaboration Queries/General/Total number of detections by MDO over time.yaml