Guides

DMARC, SPF and DKIM for Microsoft 365

27 October 2026

For a custom domain on Microsoft 365 you publish three things at your DNS host: an SPF TXT record with include:spf.protection.outlook.com, two DKIM CNAME records that Microsoft gives you, and a DMARC TXT record at _dmarc. Then you turn on DKIM signing in the Defender portal. Your onmicrosoft.com domain is handled for you. Your own domain is not.

What Microsoft does and does not do for you

Microsoft’s documentation draws a clear line between the two kinds of domain in a tenant:

Most people send from the custom domain, so that is where the work is.

Step 1: SPF

The record Microsoft gives for commercial Microsoft 365 and GCC:

v=spf1 include:spf.protection.outlook.com -all

Other clouds use a different include. GCC High and DoD use include:spf.protection.office365.us, and Microsoft 365 operated by 21Vianet uses include:spf.protection.partner.outlook.cn.

Notes from Microsoft’s article:

Step 2: DKIM

Microsoft uses CNAME records that point to keys it hosts, which lets it rotate keys for you. In the Microsoft Defender portal:

  1. Go to Email & collaboration, Policies & rules, Threat policies, Email authentication settings, and open the DKIM tab.
  2. Find your domain. It should show as Disabled with a status of NoDKIMKeys. Turn the toggle to Enabled.
  3. A Client error dialog appears. Microsoft says this is expected. Click OK, and the status changes to CnameMissing.
  4. Click the domain row to open its details, and copy the two values under Publish CNAMEs.
  5. At your DNS host, create the two CNAME records.
  6. Back in the details pane, turn on Sign messages for this domain with DKIM signatures.

The records look like this. Microsoft’s example values:

selector1._domainkey  CNAME  selector1-contoso-com._domainkey.contoso.n-v1.dkim.mail.microsoft
selector2._domainkey  CNAME  selector2-contoso-com._domainkey.contoso.n-v1.dkim.mail.microsoft

Do not type those. Microsoft says part of the target is assigned per tenant, so copy the exact values from the portal or from PowerShell. Other points from the article:

If you prefer PowerShell, Exchange Online has New-DkimSigningConfig, Get-DkimSigningConfig to read the CNAME values, and Set-DkimSigningConfig -Enabled $true to turn signing on. The default key size is 1024 bits. You can ask for 2048 with -KeySize 2048 when creating the config, or move to 2048 during a rotation with Rotate-DkimSigningConfig. Microsoft says a rotated key takes effect after four days.

For the general idea behind selectors and keys, see how to set up DKIM.

Step 3: DMARC

Microsoft’s DMARC article recommends starting at p=none and moving up slowly. A first record:

_dmarc  TXT  "v=DMARC1; p=none; rua=mailto:dmarc-reports@example.com"

Microsoft’s rollout, in order:

  1. Start with p=none, ideally on a low-volume subdomain or domain, and watch the reports.
  2. Move to p=quarantine. Optionally step pct through 10, 25, 50, 75, and 100.
  3. Move to p=reject, again optionally stepping pct.
  4. Repeat for other subdomains in order of increasing volume and complexity, and do the parent domain last.

Microsoft gives no fixed timing. It says to go slowly and deal with the issues the reports reveal. Our guide to DMARC policies covers how to judge when to move. One note on pct: RFC 9989, the DMARC standard published in May 2026, removed it in favor of a t=y testing flag. Microsoft still documents it.

Reports with Microsoft 365

Our guide to reading a DMARC report explains what the reports contain.

The onmicrosoft.com domain

You can add DMARC to it in the Microsoft 365 admin center: Settings, then Domains, select the onmicrosoft.com domain, open DNS records, and add a TXT record named _dmarc. Microsoft’s example value is v=DMARC1; p=reject. That is reasonable if nobody sends from that address.

Step 4: Other services sending as your domain

A Microsoft 365 tenant rarely sends alone. Newsletters, store notifications, help desks, and invoicing apps all send as example.com too. Each needs DKIM on your domain, set up inside that service, or its mail will fail DMARC once you enforce. Your first reports will list them. If a source passes SPF or DKIM on the wrong domain, our guide to why DMARC fails shows how to fix it.

Step 5: Check a message

Send a message from Outlook to an address outside your organization, such as a personal Gmail account. Microsoft notes that messages between users in the same organization may not carry a DKIM signature, and advises against testing with AOL. In the received message’s headers, look for:

If d= shows your onmicrosoft.com domain, DKIM signing is not turned on for the custom domain yet.

How Microsoft 365 treats inbound mail that fails DMARC

This is the other direction: mail arriving at your tenant from domains with their own DMARC policies. With the anti-phishing setting Honor DMARC record policy turned on, which Microsoft recommends:

Microsoft also says outbound mail from your domains that fails DMARC at the destination is routed through its high-risk delivery pool when your policy is quarantine or reject. One more reason to fix your own senders before you enforce.

Parked domains

If the tenant holds domains that never send mail, Microsoft suggests locking them down instead of leaving them blank: v=spf1 -all for SPF, v=DMARC1; p=reject; for DMARC, and no DKIM records at all.

Sources