Microsoft 365: set up SPF, DKIM and DMARC step by step

With Microsoft 365, SPF, DKIM and DMARC are not set up from the start as long as you use your own domain. You add three records in your domain's DNS and turn on DKIM in the Microsoft portal. It takes about half an hour, plus waiting time for DNS.

Add SPF

At your DNS provider, create a TXT record for the main domain (name @ or empty):

v=spf1 include:spf.protection.outlook.com -all

Set up DKIM

With Microsoft 365, DKIM consists of two CNAME records. Microsoft creates two keys so that a key change is possible without downtime.

  1. Open the Microsoft Defender portal (security.microsoft.com) and go to Email & collaboration › Policies & rules › Threat policies › Email authentication settings. Menu names change from time to time. If necessary, search for “DKIM”.
  2. In the DKIM tab, select your domain.
  3. If no keys exist yet, choose Create DKIM keys. The portal then shows you two CNAME records:
Name (host)TypeValue (target)
selector1._domainkeyCNAMEselector1-example-com._domainkey.yourtenant.onmicrosoft.com
selector2._domainkeyCNAMEselector2-example-com._domainkey.yourtenant.onmicrosoft.com

The values in the table are examples. Copy your values exactly from the portal. They contain your domain with hyphens instead of dots and the name of your tenant.

  1. Create both CNAME records in DNS and wait until they can be resolved (minutes to a few hours).
  2. In the portal, turn on Sign messages for this domain with DKIM signatures.

Microsoft signs the default domain yourcompany.onmicrosoft.com itself. For your own domain, you have to do the steps above.

Add DMARC

Create a TXT record for _dmarc, for example to start with:

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

With p=none, nothing happens to emails yet, but you receive reports on who sends in your name. Later you tighten it to quarantine and reject. The DMARC generator creates the record, and the article Reading DMARC reports explains the next steps.

Check everything

  1. Check the records with the SPF checker, the DKIM checker (selectors selector1 and selector2) and the DMARC checker.
  2. Then send a real email from Outlook to a Postwacht test address. The report shows SPF, DKIM and DMARC from the recipient's point of view.

Typical mistakes