Microsoft 365 Email Authentication Setup

Microsoft's cloud-based email and office productivity platform. This guide covers the complete email authentication stack for Microsoft 365: SPF, DKIM, and DMARC. Each section gives you the exact DNS records, step-by-step instructions, common pitfalls, and how to verify your setup.

How to Set Up SPF for Microsoft 365

Add the correct SPF record to authorize Microsoft 365 (Exchange Online) to send email on behalf of your domain.

Quick Answer — The Record You Need

Type

TXT

Host / Name

@

Value
v=spf1 include:spf.protection.outlook.com ~all

This is the standard include for all Microsoft 365 / Exchange Online tenants.

Step-by-Step Setup

1

Sign in to your DNS provider

Log in to the DNS management portal for your domain (e.g., GoDaddy, Cloudflare, Namecheap, or Microsoft if they manage your DNS).

2

Check for an existing SPF record

Look for a TXT record starting with v=spf1. You must have only one SPF record per domain.

dig TXT yourdomain.com +short | grep spf
3

Create or update the SPF TXT record

Add a new TXT record (or modify the existing one) with host @ and the value below.

v=spf1 include:spf.protection.outlook.com ~all
4

Wait for DNS propagation

DNS changes can take up to 48 hours to propagate, though most providers update within minutes.

5

Verify in Microsoft 365 Admin Center

Go to the Microsoft 365 Admin Center > Settings > Domains > select your domain > DNS records. Microsoft will check your SPF record and show a green checkmark when valid.

Before & After

Before
v=spf1 ~all
After
v=spf1 include:spf.protection.outlook.com ~all

SPF Gotchas

  • The correct include is spf.protection.outlook.com, not outlook.com or microsoft.com. Using the wrong value will not authorize Microsoft 365 mail servers.
  • If you also use on-premises Exchange in a hybrid deployment, you may need to add your on-premises server IPs to the SPF record as well.
  • Microsoft 365 automatically adds the include during domain setup if Microsoft manages your DNS, but you need to add it manually for third-party DNS providers.

SPF FAQ

What SPF record do I need for Microsoft 365?

You need a TXT record at @ with the value v=spf1 include:spf.protection.outlook.com ~all. This authorizes Exchange Online servers to send email for your domain.

Do I need different SPF records for Exchange Online and on-premises Exchange?

If you run a hybrid Exchange deployment, you need both the Microsoft 365 include and your on-premises server IPs: v=spf1 include:spf.protection.outlook.com ip4:YOUR.SERVER.IP ~all.

I see spf.protection.outlook.com and protection.outlook.com. Which is correct?

Use include:spf.protection.outlook.com for SPF records. The hostname protection.outlook.com (without the spf. prefix) is used for MX records, not SPF.

How to Set Up DKIM for Microsoft 365

Enable DKIM signing in Microsoft 365 Defender and publish CNAME records to allow Microsoft to sign outgoing email with your domain.

Quick Answer — The Record You Need

Type

CNAME

Host / Name

selector1._domainkey

Value
selector1-yourdomain-com._domainkey.yourtenant.onmicrosoft.com

You need two CNAME records: selector1._domainkey and selector2._domainkey. Replace yourdomain-com and yourtenant with your actual values.

Step-by-Step Setup

1

Open Microsoft 365 Defender

Go to security.microsoft.com and sign in with your admin account. Navigate to Email & collaboration > Policies & rules > Threat policies > Email authentication settings > DKIM.

2

Select your domain

Click on your custom domain in the DKIM page. Microsoft will display the two CNAME records you need to publish.

3

Add the CNAME records to your DNS

Create two CNAME records in your DNS provider with the host names and values shown by Microsoft.

selector1._domainkey  CNAME  selector1-yourdomain-com._domainkey.yourtenant.onmicrosoft.com
selector2._domainkey  CNAME  selector2-yourdomain-com._domainkey.yourtenant.onmicrosoft.com
4

Enable DKIM signing

Return to the Microsoft 365 Defender DKIM page and toggle the "Sign messages for this domain with DKIM signatures" switch to Enabled.

5

Verify DKIM is working

Send a test email and check the headers. Look for DKIM-Signature with d=yourdomain.com and a pass result in Authentication-Results.

DKIM Gotchas

  • Microsoft 365 DKIM uses CNAME records, not TXT records. The CNAMEs point to Microsoft-hosted keys that Microsoft rotates automatically.
  • The CNAME host names include your domain with dots replaced by dashes. For example, example.com becomes example-com in the CNAME value.
  • You cannot enable DKIM signing in the portal until the CNAME records have propagated. If the toggle fails, wait for DNS propagation and try again.

DKIM FAQ

What DKIM selectors does Microsoft 365 use?

Microsoft 365 uses selector1 and selector2 as DKIM selectors. Both are published as CNAME records pointing to Microsoft-managed keys under your tenant's onmicrosoft.com domain.

Does Microsoft 365 rotate DKIM keys automatically?

Yes. Because the DKIM records are CNAMEs pointing to Microsoft-managed DNS, Microsoft can rotate the underlying keys without requiring you to update your DNS records.

Why does Microsoft 365 use CNAME records for DKIM instead of TXT?

CNAME records allow Microsoft to manage and rotate the DKIM keys on their side without requiring customers to update DNS records each time a key rotation occurs.

How to Set Up DMARC for Microsoft 365

Publish a DMARC policy to protect your Microsoft 365 domain from spoofing and phishing by instructing receivers how to handle unauthenticated email.

Quick Answer — The Record You Need

Type

TXT

Host / Name

_dmarc

Value
v=DMARC1; p=none; rua=mailto:[email protected]; ruf=mailto:[email protected]; fo=1

Start with p=none to monitor before enforcing. Ensure SPF and DKIM pass first.

Step-by-Step Setup

1

Confirm SPF and DKIM are working

DMARC requires at least one of SPF or DKIM to pass and align. Verify both are set up for your Microsoft 365 domain.

2

Decide on a reporting address

Choose a mailbox or DMARC reporting service to receive aggregate (rua) and forensic (ruf) reports.

3

Create the DMARC TXT record

Add a TXT record in your DNS with host _dmarc and your policy value.

v=DMARC1; p=none; rua=mailto:[email protected]; ruf=mailto:[email protected]; fo=1
4

Analyze reports and authenticate all senders

Monitor aggregate reports for 2-4 weeks. Ensure all legitimate senders (marketing platforms, CRM, etc.) pass SPF or DKIM with domain alignment.

5

Move to enforcement

Gradually tighten the policy: p=quarantine with pct=25, then pct=50, pct=100, and finally p=reject.

v=DMARC1; p=reject; rua=mailto:[email protected]; fo=1

Before & After

Before
(no DMARC record)
After
v=DMARC1; p=none; rua=mailto:[email protected]; ruf=mailto:[email protected]; fo=1

DMARC Gotchas

  • Microsoft 365 emails pass DKIM alignment only if you have enabled custom DKIM signing with your domain. The default *.onmicrosoft.com signing will not align with your custom domain.
  • If you have third-party services sending as your domain (marketing tools, CRMs), they must be included in SPF or set up their own DKIM signing before you enforce DMARC.
  • Microsoft provides DMARC reports for mail received by Microsoft 365 users. To receive them for your domain, you must publish the rua tag in your DMARC record.

DMARC FAQ

Do I need DMARC if I already have SPF and DKIM on Microsoft 365?

Yes. SPF and DKIM authenticate email, but DMARC tells receiving servers what to do when authentication fails. Without DMARC, receivers make their own decisions about unauthenticated mail.

Can Microsoft 365 send DMARC aggregate reports?

Yes. Microsoft 365 (Exchange Online Protection) sends DMARC aggregate reports to domains that have a rua tag in their DMARC record.

What should my final DMARC policy be for Microsoft 365?

The recommended final policy is p=reject, which instructs receivers to reject any email that fails DMARC authentication. Only move to reject after confirming all legitimate senders pass.

Verify Your Microsoft 365 Setup

Once your SPF, DKIM, and DMARC records are in place, run a full domain scan to confirm everything is configured correctly. DNS changes typically propagate within minutes but can take up to 48 hours.

Setup Guides for Other Providers