Records to publish
Hosts are full names, with {domain} standing for your domain; most DNS panels want only the part before it (@ for the domain itself). Anything else in {braces} is specific to your Microsoft 365 account: copy it from Microsoft 365's setup screen, which shows the exact record.
| For | Type | Host | Value |
|---|---|---|---|
| Domain verification | TXT | {domain} | MS=ms{8-digit-number}Shown by the domain setup wizard; an MX record or a website file can verify the domain instead. |
| Receiving mail | MX | {domain} | priority 0 · {domain-key}.mail.protection.outlook.comCopy the exact value from the Microsoft 365 admin center; use the highest priority available, typically 0. |
| SPF | TXT | {domain} | v=spf1 include:spf.protection.outlook.com -allWorldwide and GCC; GCC High and DoD use include:spf.protection.office365.us, 21Vianet include:spf.protection.partner.outlook.cn. |
| DKIMCustom domains added since May 2025 | CNAME | selector1._domainkey.{domain} | selector1-{domain-with-dashes}._domainkey.{initial-domain-prefix}.{partition-character}-v1.dkim.mail.microsoft{initial-domain-prefix} is the custom part of your onmicrosoft.com domain; copy the exact value from the Defender portal. |
| DKIMCustom domains added since May 2025 | CNAME | selector2._domainkey.{domain} | selector2-{domain-with-dashes}._domainkey.{initial-domain-prefix}.{partition-character}-v1.dkim.mail.microsoftSame partition letter as selector1; needed for key rotation even though one selector signs at a time. |
| DKIMOlder custom domains | CNAME | selector1._domainkey.{domain} | selector1-{domain-with-dashes}._domainkey.{initial-domain-prefix}.onmicrosoft.comCustom domains that existed before May 2025; the old and new formats can't coexist for the same selector. |
| DKIMOlder custom domains | CNAME | selector2._domainkey.{domain} | selector2-{domain-with-dashes}._domainkey.{initial-domain-prefix}.onmicrosoft.com |
| DMARC optional | TXT | _dmarc.{domain} | v=DMARC1; p=none; rua=mailto:{report-address}Microsoft advises p=none first, then quarantine, then reject; for a parked domain it suggests v=DMARC1; p=reject; |
SPF
Publish v=spf1 include:spf.protection.outlook.com -all at your root domain; GCC High and DoD use include:spf.protection.office365.us, and 21Vianet include:spf.protection.partner.outlook.cn. Exchange Online sends with the user's address as the MAIL FROM, so SPF passes and aligns with your From domain.
DKIM
Publish two CNAMEs, selector1._domainkey and selector2._domainkey, then enable DKIM for the custom domain; Microsoft doesn't sign as that domain until you do. PowerShell creates 1024-bit RSA keys unless you pass -KeySize 2048, and 2048-bit can also be chosen at rotation. Rotation is manual (Rotate DKIM keys in the Defender portal, or Rotate-DkimSigningConfig) and the switch takes four days.
DMARC alignment
Both align once set up: SPF because Exchange Online uses the sender's address as the MAIL FROM, and DKIM after you publish both selector CNAMEs and enable DKIM for the custom domain. Mail signed only by your tenant's onmicrosoft.com domain does not align.
Common mistakes
- Custom domains added since May 2025 get the new CNAME target under dkim.mail.microsoft while older ones keep onmicrosoft.com, so copy the values from the Defender portal or Get-DkimSigningConfig instead of building them by hand.
- Publish both selector1 and selector2; without selector2, key rotation fails later.
- Many DNS hosts append the zone, so enter only selector1._domainkey there; typing the full name creates selector1._domainkey.example.com.example.com.
- Keep one SPF record per domain within 10 DNS lookups, and don't flatten include:spf.protection.outlook.com, as Microsoft warns.
- Microsoft 365 never sends DMARC forensic (ruf) reports, and sends aggregate reports only when your MX points directly to Microsoft 365.
- With p=quarantine or p=reject, outbound mail that fails DMARC at the destination is routed through the high-risk delivery pool.
Check that it worked
DNS changes can take a few minutes to show. Then run the free checks, no account needed:
How EmailSecOps recognises Microsoft 365
A domain check names the services it finds in your DNS, leftovers from older setups included, so you can see which senders are set up and which are missing a key:
- SPF include, current or legacy: spf.protection.outlook.com, spf.protection.office365.us, spf.protection.partner.outlook.cn
- Default DKIM selectors: selector1, selector2
- DKIM keys delegated (CNAME) to *.onmicrosoft.com, *.dkim.mail.microsoft
Questions
What SPF record does Microsoft 365 need?+
What are the DKIM records for Microsoft 365?+
Does Microsoft 365 mail pass DMARC?+
Do I need a separate DMARC record for Microsoft 365?+
Sources
- Set up SPF to identify valid email sources for your Microsoft 365 domain - Microsoft Learn
- How to use DKIM for email in your custom domain - Microsoft Learn
- Set up DMARC to validate email in Microsoft 365 - Microsoft Learn
- Connect your domain by adding DNS records - Microsoft 365 admin
- Gather the information you need to create DNS records - Microsoft 365 admin