Skip to main content
ShieldMarc
Resources/Guides
Guide

DMARC for Microsoft 365 (Office 365) Setup

Microsoft 365 is the most widely used business email platform in the world, which makes it one of the most impersonated. Without proper email authentication, attackers can send messages that appear to come from your domain, damaging your reputation and putting your recipients at risk. This guide walks you through setting up SPF, DKIM, and DMARC for Microsoft 365 so that receiving mail servers can verify your emails are genuine.

10 min read · Updated June 2026

Why DMARC matters for Microsoft 365 tenants

DMARC (Domain-based Message Authentication, Reporting and Conformance) ties together SPF and DKIM to give domain owners control over what happens when an email fails authentication. Without DMARC, a spoofed message using your domain can land in your customers' inboxes with no way for them to distinguish it from a legitimate email.

Microsoft 365 provides built-in support for all three protocols, but it does not configure them for your custom domain automatically. You need to publish the correct DNS records and enable DKIM signing yourself. The good news is that the entire process takes about 30 minutes once you know what to do.

If you are new to these protocols, our complete guide to DMARC and SPF vs DKIM vs DMARC comparison explain how they work together to protect your domain.

Step 1: Configure SPF for Microsoft 365

SPF (Sender Policy Framework) tells receiving mail servers which IP addresses are allowed to send email on behalf of your domain. For Microsoft 365, you need to publish a TXT record in your domain's DNS that includes Microsoft's sending infrastructure.

Add the following TXT record to your domain's DNS zone:

Host: @

Type: TXT

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

This record authorises all Microsoft 365 mail servers to send on your behalf. The ~all (soft fail) is the right qualifier for any active sending domain and should stay as ~all. Once DMARC is at p=reject the policy decision is made by DMARC, not by SPF. Tightening to -all adds no extra protection and breaks legitimate forwarded mail. Reserve -all for parked or non-sending domains. See our guide on SPF hard fail vs soft fail for the full reasoning.

If you use other sending services (marketing platforms, CRM tools, helpdesk software), you will need to add their SPF include mechanisms as well. For example, if you also send through Mailchimp and Zendesk:

v=spf1 include:spf.protection.outlook.com include:servers.mcsv.net include:mail.zendesk.com ~all

Be careful not to exceed the 10 DNS lookup limit for SPF. Each include: adds to your lookup count. If you are running into this limit, see our guide on fixing the SPF too many DNS lookups error or use our SPF Flattener tool to reduce lookup counts.

Use our free SPF Generator to build a valid SPF record that includes all your sending services, with the correct syntax.

Step 2: Enable DKIM signing in Microsoft 365

DKIM (DomainKeys Identified Mail) adds a cryptographic signature to every outgoing email. The receiving server looks up the public key in your DNS and verifies that the message has not been altered in transit. Microsoft 365 signs emails with DKIM by default using its own domain, but for proper alignment with your custom domain, you need to set up custom DKIM signing.

Create the CNAME records

You need to add two CNAME records to your DNS. Replace yourdomain-com with your domain (hyphens replacing dots) and yourtenant with your Microsoft 365 tenant name:

Host: selector1._domainkey

Type: CNAME

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

Host: selector2._domainkey

Type: CNAME

Value: selector2-yourdomain-com._domainkey.yourtenant.onmicrosoft.com

For example, if your domain is example.com and your tenant is contoso, the first record would be:

selector1._domainkey.example.com CNAME selector1-example-com._domainkey.contoso.onmicrosoft.com

Enable signing in the Microsoft 365 admin portal

  1. Go to the Microsoft Defender portal (security.microsoft.com).
  2. Navigate to Email & collaboration > Policies & rules > Threat policies > DKIM.
  3. Select your custom domain from the list.
  4. Toggle Sign messages for this domain with DKIM signatures to enabled.

Microsoft uses two selectors so it can rotate keys automatically. When a key rotation occurs, the active selector switches from selector1 to selector2 (or vice versa) without requiring any DNS changes on your end.

For detailed instructions for other providers alongside Microsoft 365, see our DKIM setup by provider guide. You can also use our DKIM Generator to create DKIM records for any service.

Step 3: Publish a DMARC record

With SPF and DKIM in place, you can now publish a DMARC record. DMARC tells receiving servers what to do when an email fails both SPF and DKIM alignment checks, and where to send aggregate reports so you can monitor authentication results.

Start with a monitoring-only policy so you can observe what is happening before enforcing anything:

Host: _dmarc

Type: TXT

Value: v=DMARC1; p=none; rua=mailto:dmarc@yourdomain.com

The p=none policy means no action is taken on failing emails. Instead, you receive daily aggregate reports (sent to the address in the rua tag) that show which IPs are sending email using your domain and whether they pass or fail authentication.

The path to enforcement

Once you have reviewed your DMARC reports and confirmed that all legitimate senders pass authentication, you can progressively tighten your policy:

  1. Monitor (p=none). Collect aggregate reports until every authorised sender is consistently aligning under SPF or DKIM. The gate is report cleanliness, not the calendar. Fix every misconfigured sender before moving on.
  2. Quarantine (p=quarantine).Failing emails are sent to the recipient's spam folder. This is a safe intermediate step that catches spoofed messages without blocking them outright.
  3. Reject (p=reject). Failing emails are blocked entirely. This is the strongest protection and the recommended end state for any domain sending email. The Microsoft bulk sender requirements mandate at least p=none from high-volume senders, with enforcement as the goal.

To understand what your DMARC reports are telling you, read our guide on understanding DMARC reports.

Use our free DMARC Generator to build a valid DMARC record with the correct syntax, including optional tags like pct, sp, and fo.

Step 4: Verify everything is working

After publishing your DNS records and enabling DKIM in the Microsoft 365 portal, verify that all three protocols are configured correctly:

  • DMARC Checker validates your DMARC, SPF, and DKIM records in one scan. Enter your domain and confirm that all three show a pass status.
  • Security Grade provides a full security posture assessment covering DMARC, SPF, DKIM, MTA-STS, DNSSEC, and TLS certificates. Use it to see where your domain stands overall.
  • Email Header Analyser lets you inspect the authentication headers of a test email. Send a message from your Microsoft 365 mailbox, copy the full headers from the received message, and paste them into the analyser to confirm that SPF, DKIM, and DMARC all show a pass result.

You can also use our DNS Lookup tool to query your TXT and CNAME records directly and confirm they are resolving as expected.

Common Microsoft 365 issues

These are the problems we see most frequently when organisations set up email authentication for Microsoft 365:

  • DKIM CNAME propagation delay. After adding the CNAME records, it can take anywhere from a few minutes to several hours for DNS to propagate. If the Microsoft 365 portal shows an error when you try to enable DKIM signing, wait 30 to 60 minutes and try again. You can monitor propagation using our DNS Lookup tool.
  • Exceeding the SPF 10 lookup limit.Microsoft 365's include:spf.protection.outlook.com alone uses several of your 10 permitted DNS lookups. Add a few more third-party services and you can easily exceed the limit, causing SPF to return a PermError. Use our SPF Flattener to reduce your lookup count, and read our guide on fixing the SPF lookup limit for a full walkthrough.
  • Third-party services breaking alignment. If you use services like Mailchimp, HubSpot, or Salesforce to send email on your behalf, they may send from their own domains rather than yours. This breaks DMARC alignment even if SPF and DKIM individually pass. You need to configure custom return-path domains and DKIM signing for each service to ensure alignment. Check our SPF vs DKIM vs DMARC guide for a detailed explanation of how alignment works.
  • Subdomain policy considerations. By default, a DMARC record at the organisational domain applies to all subdomains. If you send email from subdomains (e.g. marketing.yourdomain.com), consider adding a sp= tag to your DMARC record to set an explicit subdomain policy, or publish separate DMARC records on subdomains that need different treatment.
  • Shared or multi-tenant environments. If multiple organisations share a single Microsoft 365 tenant (common in managed service provider setups), ensure each domain has its own SPF, DKIM, and DMARC records. DKIM signing must be enabled per domain in the Defender portal.

Next steps

With SPF, DKIM, and DMARC configured for your Microsoft 365 tenant, here is what to do next:

  • Monitor your DMARC reports. Review aggregate reports regularly to catch unauthorised senders and identify legitimate services that need configuration fixes. Our guide to understanding DMARC reports explains how to read them.
  • Progress to p=reject. Do not stay on p=none indefinitely. The goal is to reach p=reject so that spoofed emails are blocked outright.
  • Aim for a strong Security Grade. A Security Grade of Level 3 means your domain has full email authentication with enforcement, MTA-STS, DNSSEC, and valid TLS certificates. It is the benchmark for a fully protected domain.
  • Read our complete guide to DMARC for a deeper understanding of the protocol and its tags.
  • Learn about DKIM setup for other providers if you send email from additional services beyond Microsoft 365.

Frequently asked questions

Why are my Microsoft 365 emails failing DMARC?

Most Microsoft 365 DMARC failures are alignment problems, not raw authentication failures: the message passes SPF or DKIM, but against the wrong domain, so it fails alignment to your visible From domain. Two patterns cause this. First, mail routed through a third-party sender (a marketing platform, CRM, or helpdesk) often passes SPF against that vendor's own domain rather than yours. Second, Microsoft 365's default return-path is yourtenant.onmicrosoft.com, so SPF can pass against the onmicrosoft.com domain while DMARC, which requires alignment to your From domain, still fails. DMARC needs at least one of SPF or DKIM to both pass and align with the From domain, per RFC 7489, the original DMARC specification, obsoleted in May 2026 by DMARCbis (RFC 9989). The fix is almost always to enable tenant DKIM on your custom domain and to align each third-party sender, then read your aggregate reports to confirm.

How do I enable DKIM signing in Microsoft 365?

Enable DKIM by publishing two custom-domain CNAME records and then toggling signing on in the Microsoft Defender portal. Add selector1._domainkey and selector2._domainkey CNAMEs that point at the matching onmicrosoft.comtargets for your tenant, wait for DNS to propagate, then go to Email and collaboration, Policies and rules, Threat policies, DKIM, select your custom domain, and switch on signing. Microsoft uses two selectors so it can rotate keys automatically without further DNS changes. Custom DKIM is what lets the signature align to your From domain; the default signing only covers the onmicrosoft.com domain. Step-by-step DNS values are in the DKIM section above and in Microsoft's own DMARC configuration guide at learn.microsoft.com.

Why does Microsoft 365 mail fail SPF alignment?

Microsoft 365 mail fails SPF alignment when the envelope sender (the return-path SPF checks) is on a different domain from your visible From address. SPF is evaluated against the MAIL FROM domain, which for Microsoft 365 defaults to yourtenant.onmicrosoft.com, and for third-party senders is usually their own bounce domain. SPF can pass against that domain yet still fail DMARC's alignment test against your From domain, as defined in RFC 7208 and RFC 7489, obsoleted in May 2026 by DMARCbis (RFC 9989). Forwarding makes this worse, because a forwarder rewrites the envelope and breaks SPF entirely; DKIM and ARC are what survive forwarding. The practical answer is to rely on aligned DKIM for Microsoft 365, configure custom return-path domains for third-party senders, and use aggregate reports to find the misaligned source.

How do I fix DMARC failures for Microsoft 365?

Fix Microsoft 365 DMARC failures by enabling aligned tenant DKIM, aligning every third-party sender, and using your aggregate (RUA) reports to identify exactly which source is misaligned before you tighten policy. Start at p=none with a rua= address so reports flow in, turn on custom-domain DKIM in the Defender portal, then for each marketing platform, CRM, or helpdesk that sends as your domain, set up a custom return-path and DKIM signing so it aligns. Forwarded mail should lean on DKIM and ARC rather than SPF. Only progress p=none to p=quarantine to p=reject once reports confirm every legitimate sender passes; we do not recommend ramping the pct= tag, because it only samples mail at random and delays nothing useful. DMARCbis (RFC 9989) removes the pct=tag entirely (Appendix A.6), which is why the right approach is report-driven rather than pct-based. ShieldMarc ingests these reports, tracks SPF and DKIM alignment per sender, and explains each failure in plain English so you can see which source to fix. Microsoft's DMARC guidance is at learn.microsoft.com.

Is your Microsoft 365 email properly authenticated?

Find out in seconds with our free DMARC Checker. If you want continuous monitoring across all your domains, with alerts for policy changes, authentication failures, and new unauthorised senders, create a free ShieldMarc account and start protecting your email in under two minutes.