Email and collaboration protection with Defender for Office 365 · Prepare
Set up SPF, DKIM and DMARC
SPF and DKIM for every sending domain, then DMARC raised step by step from monitoring to reject.
- Duration
- 6 to 12 weeks, mostly monitoring
- Effort
- About 4 to 8 person-days, depending on the number of domains and senders
- Complexity
- Medium
- Beyond E5
- Nothing beyond Microsoft 365 E5
On this page
Overview
SPF lists the sources allowed to send for a domain. DKIM signs each message so receivers can check it wasn't changed and came from the domain. DMARC tells receivers what to do when SPF or DKIM fail and sends reports back. The onmicrosoft.com domain is handled by Microsoft; custom domains aren't DKIM signed until you set it up. Microsoft recommends a gradual DMARC rollout, ending at reject for every domain.
Technically, you create or update SPF TXT records at the DNS host, turn on DKIM signing for each custom domain in the Defender portal and publish its CNAME records, then publish DMARC TXT records starting at p=none with report addresses, moving to quarantine and reject as reports confirm legitimate mail passes. Parked domains get records saying no mail is ever sent from them.
You'll end up with: Every domain with SPF and DKIM, DMARC at reject for sending domains, parked domains locked down, and reports reviewed.
If you skip it: Without authentication, anyone can send mail that appears to come from the organization, and well-run receivers increasingly junk or reject unauthenticated mail.
Before you start
The path to this playbook
- Plan email and collaboration protection
- Set up SPF, DKIM and DMARC (you are here)
- Plan email and collaboration protection: Domains to authenticate, preset or custom policies, who gets Strict protection, and who runs reported messages and quarantine.
- Have the domain and sender inventory
How to do it
Authentication covers every domain and sending service from Plan email and collaboration protection. A sender missing from the list fails once DMARC is enforced.
- Choose where DMARC reports go
How to do it
Aggregate reports summarize passes and failures; forensic reports give near-immediate detail of failures. Choose a mailbox or a reporting service that can read them.
Test to sign-off
4 phases · 2 decisionsSet up SPF1 to 2 weeks
Create or correct the SPF record for each sending domain and subdomain, listing every legitimate source, and lock down parked domains.
Move on when Each domain has exactly one SPF record that passes for every listed sender.
Key decisions for this phase (1)
Where do third-party senders send from?
Recommended default: A subdomain per third-party service, such as news.example.com
Bulk and marketing services send large volumes and can harm the reputation of the domain they use. Microsoft recommends a subdomain for services outside your direct control.
How to do it
Only one SPF record is allowed per domain or subdomain; more than one causes an error. Keep the record under 10 DNS lookups. Microsoft recommends ending the record with -all (hard fail) because DKIM and DMARC are also configured.
Watch out for (1)
If you: Add a second SPF record for a new service
What tends to happen: SPF returns an error for every message, and the domain's mail fails authentication
A better approach:Edit the existing record to add the service, and check the lookup count
Set up DKIM1 to 2 weeks
Turn on DKIM signing for each custom domain, publish the CNAME records, and ask each third-party sender to sign with your domain.
Move on when Test messages from each domain and each third-party sender show DKIM passing with the organization's domain.
How to do it
Outbound mail from custom domains isn't DKIM signed until you configure it. DKIM passes DMARC only when the signing domain aligns with the From address domain, so third-party senders need to sign with your domain, not theirs.
Watch out for (1)
If you: Assume Microsoft signs mail for custom domains
What tends to happen: Mail is signed with the onmicrosoft.com domain, which doesn't align with the From address, so DMARC relies on SPF alone
A better approach:Turn on DKIM for every custom domain and check a sent message's headers
Monitor with DMARC p=none2 to 4 weeks
Publish DMARC at p=none with report addresses on the pilot domain, then all sending domains, and fix every legitimate sender that fails.
Move on when Reports show legitimate mail passing for every known sender.
How to do it
The DMARC record for a domain also covers subdomains without their own record, but each subdomain still needs its own SPF and DKIM. Parked domains, including onmicrosoft.com if it isn't used for mail, should have records stating that no mail comes from them.
Move to quarantine, then reject4 to 6 weeks
Raise the policy to p=quarantine, using pct to apply it to a growing share of failing mail, then to p=reject once reports stay clean.
Move on when Every sending domain is at p=reject, and reports are reviewed on a schedule.
Key decisions for this phase (1)
How fast do we move to reject?
Recommended default: Step by step, with at least two clean weeks at each stage
Microsoft's guidance is to move step by step, monitoring at each stage, and to use pct values below 100 for testing. Moving too fast blocks legitimate mail from a sender nobody listed.
Watch out for (1)
If you: Stop at p=none
What tends to happen: Reports arrive, but attackers can still send as the organization and receivers deliver it
A better approach:Plan the dates for quarantine and reject when you publish p=none
Tell the owners of systems that send email why their service needs to change, and give them a date. Most failures at enforcement come from a sender someone set up years ago and forgot.
How you'll know it's working
3 measures
Capture a baseline before you start, or you won't be able to show the change.
| Measure | Where you see it | Good direction |
|---|---|---|
| Sending domains at DMARC p=reject | DNS and domain inventory | Up |
| Legitimate senders failing DMARC | DMARC aggregate reports | Down |
| Spoofed messages using the organization's domains | DMARC reports and spoof intelligence | Down |
Take it with you
plan, decisions, gate checks, 1 template
Plan outline: phases and when to move on
- Set up SPF (1 to 2 weeks). Move on when: Each domain has exactly one SPF record that passes for every listed sender.
- Set up DKIM (1 to 2 weeks). Move on when: Test messages from each domain and each third-party sender show DKIM passing with the organization's domain.
- Monitor with DMARC p=none (2 to 4 weeks). Move on when: Reports show legitimate mail passing for every known sender.
- Move to quarantine, then reject (4 to 6 weeks). Move on when: Every sending domain is at p=reject, and reports are reviewed on a schedule.
Decisions to record, with the recommended answer
| Decision | Recommended default | Our choice |
|---|---|---|
| Where do third-party senders send from? | A subdomain per third-party service, such as news.example.com | |
| How fast do we move to reject? | Step by step, with at least two clean weeks at each stage |
Gate checks: questions to answer before each phase ends
Before leaving Set up SPF
- Does each domain have exactly one SPF record?
Before leaving Set up DKIM
- Do test messages show DKIM aligned with the From domain?
Before leaving Monitor with DMARC p=none
- Is every legitimate sender passing in the reports?
Before leaving Move to quarantine, then reject
- Is every sending domain at p=reject?
Sender inventory row
Domain: [name]. Sender: [service]. Owner: [person]. SPF: [included Y/N]. DKIM: [signs with our domain Y/N]. DMARC result: [pass/fail]. Action: [fix needed].
Microsoft Learn
5 links
Contributor

Microsoft 365 architecture and governance · Protiviti
Compare notes or suggest an improvement
Changelog
Changelog (1 version)
| Version | Date | By | Change |
|---|---|---|---|
| 1 | Sev Derghazarian | First draft. |