ReplyDak

How to set up SPF, DKIM and DMARC for Microsoft 365

Updated 10 November 2026 · 6 min read

Short answer

For a custom domain on Microsoft 365, publish v=spf1 include:spf.protection.outlook.com -all at the root, create two CNAME records (selector1._domainkey and selector2._domainkey) with the exact targets shown in the Microsoft Defender portal, turn DKIM signing on for the domain, then add a DMARC TXT record at _dmarc starting with p=none. Microsoft recommends -all because it also expects DKIM and DMARC to be in place.

The records Microsoft 365 needs

TypeHost / NameValue
TXT@v=spf1 include:spf.protection.outlook.com -all
CNAMEselector1._domainkeyselector1-yourdomain-com._domainkey.<tenant>.<x>-v1.dkim.mail.microsoft (copy from the portal)
CNAMEselector2._domainkeyselector2-yourdomain-com._domainkey.<tenant>.<x>-v1.dkim.mail.microsoft (copy from the portal)
TXT_dmarcv=DMARC1; p=none; rua=mailto:dmarc@yourdomain.com

Microsoft's DKIM page says the CNAME targets now use the dkim.mail.microsoft zone with a per-tenant partition letter, replacing the older selector1-yourdomain-com._domainkey.yourtenant.onmicrosoft.com format. The two formats cannot coexist for the same selector, so always copy the values your tenant shows rather than building them by hand.

Step by step

  1. 1

    Publish SPF at your DNS host

    There is no SPF setting inside Microsoft 365; you create the TXT record at the registrar or DNS host. Use one record only, and add other senders' includes to it.

  2. 2

    Open the DKIM page

    In the Microsoft Defender portal go to Email & collaboration → Policies & rules → Threat policies → Email authentication settings → DKIM, and select the custom domain.

  3. 3

    Trigger the CNAME values

    Toggling signing on before the CNAMEs exist shows a client error and the status becomes CnameMissing. That is expected: the domain flyout now lists the two CNAME values under Publish CNAMEs.

  4. 4

    Create the two CNAMEs

    Add selector1._domainkey and selector2._domainkey as CNAME records with the exact targets. If your DNS host is Cloudflare, leave them DNS-only (grey cloud).

  5. 5

    Enable signing and add DMARC

    After Microsoft detects the CNAMEs (minutes, sometimes longer) turn the toggle on, then publish DMARC at _dmarc with p=none and a report address.

Why two selectors

Microsoft holds two key pairs per domain so it can rotate keys without breaking mail: one selector signs while the other is replaced. That is also why the records are CNAMEs to keys Microsoft hosts rather than TXT records you paste. Use Rotate DKIM keys in the same flyout when you want a fresh key; the CNAMEs never change.

PowerShell alternative

Get-DkimSigningConfig -Identity yourdomain.com | Format-List Name,Enabled,Status,Selector1CNAME,Selector2CNAME
Set-DkimSigningConfig -Identity yourdomain.com -Enabled $true
ReplyDak does not sell Microsoft 365 mailboxes yet (it is coming soon and cannot be ordered). This guide is for your own Microsoft 365 tenant; ReplyDak's sending domains today run on Google Workspace.

Check the result

Send to an outside mailbox and read the Authentication-Results header: look for dkim=pass header.d=yourdomain.com, not onmicrosoft.com. Run the domain through the free ReplyDak deliverability check: it reads MX, SPF, DKIM and DMARC live from public DNS, counts SPF lookups and checks the main blocklists, with no sign-up. If your DKIM selector is not a common one, type it into the optional selector box.

More setups and errors: SPF, DKIM and DMARC by provider, DNS host and error.

FAQ

What is the SPF record for Microsoft 365?

v=spf1 include:spf.protection.outlook.com -all for commercial tenants. GCC High and DoD tenants use include:spf.protection.office365.us.

Why does the DKIM status say CnameMissing?

Microsoft cannot find the two selector CNAME records in DNS yet. Publish them exactly as shown, wait a few minutes, and try enabling again.

Does Microsoft 365 sign with DKIM without these records?

It signs with the tenant's onmicrosoft.com domain, which does not align with your From domain, so DMARC can fail. Enable DKIM for the custom domain.

Should I use -all or ~all for Microsoft 365?

Microsoft recommends -all, since DKIM and DMARC are also in place. Either ending counts as an SPF fail for DMARC.

Sources

Related

Microsoft 365 mailboxes are coming soon. Until then, new orders use Google Workspace mailboxes.