Email Security · Jason Osborne

Office 365 SPF Record, DKIM and DMARC Setup (Microsoft 365)

Office 365 SPF Record, DKIM and DMARC Setup (Microsoft 365)

For Microsoft 365 (many people still call it Office 365) you need one SPF record, two DKIM CNAME records with signing switched on, and a DMARC record. You’ll need to sign in to Microsoft 365 as an administrator and to wherever your DNS is managed.

Before you start

List every service that sends email as your domain, not just Microsoft 365. Write down your current DNS records so you can put them back.

1. SPF

  1. Open your DNS host and look for a TXT record starting v=spf1.
  2. If Microsoft 365 is your only sender, the value is v=spf1 include:spf.protection.outlook.com -all
  3. If other services send too, keep them in the same record. Never add a second SPF record.

2. DKIM

  1. Go to security.microsoft.com/authentication?viewid=DKIM and open the DKIM tab. The menu path is Email & collaboration, Policies & rules, Threat policies, Email authentication settings.
  2. Select your domain and switch the toggle to Enabled. If the records aren’t published yet, expect a message that they’re missing; it shows the two values to publish.
  3. At your DNS host, add two CNAME records named selector1._domainkey and selector2._domainkey. Copy each target exactly from the portal. The format differs between older and newer domains, so don’t copy someone else’s.
  4. Wait for DNS to update, then switch on “Sign messages for this domain with DKIM signatures.” The status should show that DKIM signatures are being signed for the domain.
  5. Send a message to a Gmail address, choose “Show original” and look for DKIM=pass with your own domain.

Upgrading an old 1024-bit key

Microsoft’s documented way to move to 2048-bit is the Exchange Online PowerShell command Rotate-DkimSigningConfig -Identity yourdomain.com -KeySize 2048. Each rotation takes about 96 hours and changes one selector, so it takes two rotations to replace both keys.

3. DMARC

First look for an existing TXT record at _dmarc. If there is one, don’t add a second one, and don’t replace a quarantine or reject policy with none. If there is none, add:

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

Then follow the staged path to reject.

Check your work

Run the free email security checker.

Official pages