MailSpecto
SPF, DKIM and DMARC 3 min read

SPF, DKIM and DMARC in Microsoft 365 – setup for your own domain

Microsoft 365 signs mail with DKIM by default, but with the onmicrosoft.com domain, not yours. Full protection needs SPF, two CNAME records for DKIM and a DMARC record. We show where in the Defender portal to turn DKIM on and where to get the exact record values.

MailSpecto Engineering Team

Mail infrastructure and deliverability

Microsoft 365 Defender portal DNS: TXT / CNAME SPF spf.protection.outlook.com DKIM selector1/2 CNAME DMARC _dmarc p=none PASS SPF · DKIM · DMARC

Based on Microsoft's documentation (as of November 2026) for the standard Microsoft 365 cloud. Government clouds and 21Vianet use different values.

1. SPF

A TXT record for the root domain, added at your DNS host:

example.com.  IN  TXT  "v=spf1 include:spf.protection.outlook.com -all"

Microsoft recommends ending with -all and a TTL of at least 3600 seconds, but set -all only once every sender is in the record. Add other sending systems to the same record. Microsoft explicitly advises against flattening its include into a list of IP addresses, because those addresses change.

2. DKIM

Without your own setup, Microsoft 365 signs mail with the *.onmicrosoft.com domain. That signature is not aligned with the sender's domain, so it does not help DMARC.

Step 1: get the record values

Each custom domain needs two CNAME records: selector1._domainkey and selector2._domainkey. Microsoft generates their targets, and you should copy them rather than build them by hand. The most reliable way is PowerShell (Exchange Online):

Get-DkimSigningConfig -Identity example.com | Format-List Name,Enabled,Status,Selector1CNAME,Selector2CNAME

Or use the Microsoft Defender portal (see step 3), which shows the values when you select the domain.

Step 2: add the CNAME records

For domains added since May 2025 the targets use a new format, for example:

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

Older domains use the selector1-example-com._domainkey.example.onmicrosoft.com format. The parts after _domainkey depend on your tenant, so the lines above are only an example.

Step 3: turn signing on

In the Microsoft Defender portal go to Email & collaboration → Policies & rules → Threat policies → Email authentication settings (directly: security.microsoft.com/authentication), DKIM tab. Click the domain and turn on Sign messages for this domain with DKIM signatures. Microsoft usually detects new CNAME records within minutes; if the portal reports an error, wait for DNS propagation and try again.

According to the documentation the default key is 1024 bits; in PowerShell (the KeySize parameter) you can set 2048, which is safer. The two selectors let keys be replaced without a gap in signing.

3. DMARC

A starter TXT record at _dmarc:

_dmarc.example.com.  IN  TXT  "v=DMARC1; p=none; pct=100; rua=mailto:[email protected]"

Microsoft describes the same gradual rollout: none, then quarantine, finally reject (see DMARC reports: from p=none to p=reject). Domains you never send from can get v=DMARC1; p=reject straight away.

4. Checking

dig +short TXT example.com | grep spf1
dig +short CNAME selector1._domainkey.example.com
dig +short TXT _dmarc.example.com

In the headers of a message sent from Outlook, look for dkim=pass header.d=example.com (your domain, not onmicrosoft.com) and dmarc=pass. The domain audit in the MailSpecto panel checks all the records at once, and DMARC reports in MailSpecto Monitor show whether mail from Microsoft 365 and your other systems passes authentication.

  1. One SPF record with include:spf.protection.outlook.com.
  2. Two DKIM CNAME records copied from the portal or PowerShell.
  3. DKIM signing turned on in the Defender portal.
  4. A _dmarc record with p=none and an rua address.
  5. In the headers: dkim=pass with your domain and dmarc=pass.

Keep your contact list clean

Verify email addresses before you send, and explore our upcoming SPF/DKIM/DMARC diagnostics module.

Try MailSpecto

MailSpecto Engineering Team

We build tools for email address verification, deliverability monitoring and mail infrastructure security diagnostics for companies in Poland and Europe.

Related articles

SPF, DKIM and DMARC

DMARC reports – how to read them and move from p=none to p=reject

How to read DMARC aggregate reports (rua) and move step by step from p=none to p=quarantine and p=reject.

Read article →
SPF, DKIM and DMARC

Multiple SPF or DMARC records on one domain – why it breaks and how to merge them

Why two SPF records or two DMARC records break email authentication, how to merge them, and how to list several DMARC report addresses in one record.

Read article →
SPF, DKIM and DMARC

No DMARC record found – what a missing DMARC record means and how to add one

What "No DMARC record found" means, exactly where to add the _dmarc record, a safe starter record, and the most common DNS panel mistakes.

Read article →