What this check looks at
Checks zero-hour auto purge is on for spam and for phishing in every inbound anti-spam policy, so a message Microsoft learns is bad after it arrived is taken back out of the mailbox.
Zero-hour auto purge (ZAP) goes back to messages already delivered. When Microsoft later learns that a message was spam or phishing, because the same campaign has now been seen elsewhere, ZAP moves the delivered copies out of the inbox. It is set separately for spam and for phishing in each inbound anti-spam policy.
The check reads every inbound anti-spam policy and passes when both are on in each. It fails naming each policy and kind of mail with the purge off, and reports not checked or partly checked when the settings were not returned.
Why it matters
Phishing campaigns are often recognised minutes after the first messages land. With the purge off, those first copies stay in people’s inboxes, ready to be clicked, even though Microsoft now knows they are malicious.
Phishing campaigns are fastest in their first hour, before every filter has seen them. The first copies are delivered, and they are only recognised as malicious once more of them arrive across Microsoft’s network. Without ZAP those first copies stay in the inbox, waiting to be opened.
The purge is on by default and costs nothing to keep on. It acts only on mail Microsoft has found to be bad, and a message moved by mistake can be released from quarantine or moved back from Junk.
How to fix it
Where: Microsoft Defender portal → Email & collaboration → Policies & rules → Threat policies → Anti-spam
Before you start
- Nothing to prepare: the purge acts only on mail Microsoft later finds to be spam or phishing.
Step by step
- See each policy’s purge settings. Run Get-HostedContentFilterPolicy | Format-Table Name, SpamZapEnabled, PhishZapEnabled to list the purge settings of every inbound anti-spam policy.
- Turn the purge on. In the Defender portal, Anti-spam, open each inbound policy, choose Actions and tick Enable zero-hour auto purge (ZAP), with both phishing and spam messages. Or run Get-HostedContentFilterPolicy | Set-HostedContentFilterPolicy -PhishZapEnabled $true -SpamZapEnabled $true.
- Check nothing exempts mailboxes. A mail flow rule that sets the spam confidence level to -1, or an allowed sender, stops ZAP acting on that mail. The checks for allowed domains and transport rules list both.
- Confirm the setting. Run the command from the first step again and check both columns show True for every policy. The next assessment passes.
With PowerShell
Get-HostedContentFilterPolicy | Set-HostedContentFilterPolicy -PhishZapEnabled $true -SpamZapEnabled $true
What users will notice
A message found to be spam or phishing after it arrived is moved out of the inbox, to Junk Email or quarantine.
How to confirm it worked
Get-HostedContentFilterPolicy | Format-Table Name, SpamZapEnabled, PhishZapEnabled shows True for every policy.
Frameworks and controls
This check maps to controls in 12 frameworks. Passing it is evidence that the setting is in place, not a certification against any of them.
| Framework | Control |
|---|---|
| NCSC CAF | B4.b Secure configuration |
| DSPT | Standard 9: IT protection |
| NIS2 | Art. 21(2)(e) Security in acquisition, development and maintenance, including vulnerability handling |
| Zero Trust | Applications |
| SOC 2 | CC6.8 Preventing or detecting unauthorised or malicious software |
| PCI DSS 4.0.1 | 5.4.1 Personnel are protected against phishing attacks |
| NIST SP 800-171 | 3.14.2 Provide protection from malicious code |
| CMMC Level 2 | SI.L2-3.14.2 Malicious Code Protection |
| ISO 27001:2022 | A.8.7 Protection against malware |
| CIS Controls v8.1 | 9.7 Deploy and maintain email server anti-malware protections (IG3) |
| NIST CSF 2.0 | RS.MI-01: Incidents are contained |
| NCSC 10 Steps | Architecture and configurationIncident management |
The framework mappings were last checked against the published standards in October 2026.
Microsoft’s documentation
- Zero-hour auto purge in Exchange Online (Microsoft Learn)