mailampel

← All articles

Setting up SPF, DKIM and DMARC for Microsoft 365 (Exchange Online): step by step

Complete email authentication for Microsoft 365: the SPF record at your DNS provider, creating DKIM in the Defender portal, publishing the CNAMEs and switching it on, setting DMARC — with the two typical Exchange Online traps.

7 min read · Updated 7 September 2026

For Microsoft 365 you set SPF and DMARC at your domain's DNS provider (there is no portal for that in Microsoft 365), but DKIM in the Microsoft Defender portal: security.microsoft.com/authentication → "DKIM" tab → domain → "Create DKIM keys" → publish the two CNAMEs shown in DNS → switch on the toggle "Sign messages for this domain with DKIM signatures". The basic SPF record is suggested during domain setup; DKIM and DMARC remain manual work — and that is exactly where the two traps we see most often in practice are hiding.

Step 1: SPF at the DNS provider

Microsoft states it explicitly: for SPF there is neither an admin portal nor a PowerShell cmdlet — the TXT record is created at the registrar or DNS hoster (e.g. World4You, Strato, IONOS). Microsoft recommends -all because DMARC handles the rest:

DNS record of type TXT:
Name / host
your-domain.com
Value
v=spf1 include:spf.protection.outlook.com -all
The standard for Exchange Online (confirmed via DNS, 7 Sept 2026). Further sending services go into the SAME record; Microsoft advises putting bulk senders on a subdomain (own SPF per subdomain) and names ten DNS lookups as the limit.

Step 2: Create DKIM in the Defender portal

DNS record of type CNAME:
Name / host
selector1._domainkey.your-domain.com
Value
selector1-your-domain-com._domainkey.yourtenant.r-v1.dkim.mail.microsoft
New pattern according to Microsoft Learn (as of 2026): domain with dashes, tenant name, a letter assigned by Microsoft (r or n) and -v1.dkim.mail.microsoft. Older tenants have targets on …onmicrosoft.com. Never retype — the portal shows the exact values.
DNS record of type CNAME:
Name / host
selector2._domainkey.your-domain.com
Value
selector2-your-domain-com._domainkey.yourtenant.r-v1.dkim.mail.microsoft
Two selectors so Microsoft can rotate keys without interruption. Both must be set.

Step 3: DMARC at the DNS provider

Microsoft does not create DMARC for you. The TXT record under _dmarc goes to the DNS provider like SPF — first with p=none and a reporting address, read reports for a few weeks, then via quarantine to reject (step-by-step plan). Microsoft itself recommends quickly setting DKIM and DMARC in monitoring mode in complex environments, because the reports reveal the forgotten senders:

DNS record of type TXT:
Name / host
_dmarc.your-domain.com
Value
v=DMARC1; p=none; rua=mailto:dmarc@your-domain.com
Every parameter in [[dmarc-eintrag|The DMARC record explained]].

Step 4: Check

After switching on, send an email to a Gmail mailbox and open "Show original" there: spf=pass, dkim=pass with your domain, dmarc=pass is the goal. Or check the domain here — then you also see whether both selectors can be found. In the Defender portal the domain's status must be "Valid"; "CnameMissing" means a CNAME is missing or not yet propagated.

Frequently asked questions

Where do I find the DKIM setting for Exchange Online?

In the Microsoft Defender portal at https://security.microsoft.com/authentication, "DKIM" tab (menu path: Email & collaboration → Policies & rules → Threat policies → Email authentication settings). Click the domain there, "Create DKIM keys", set the CNAMEs, switch on the toggle.

Does the onmicrosoft.com domain also need to be secured?

Microsoft signs and authenticates the default domain itself; you cannot even change its SPF. What matters is that your users send with your own domain — mail from the onmicrosoft address quickly looks unprofessional to recipients.

My CNAME targets end in onmicrosoft.com, the guide shows dkim.mail.microsoft — which is right?

Both exist: older tenants use targets on …onmicrosoft.com, newer ones the pattern …<letter>-v1.dkim.mail.microsoft. What counts is always what the Defender portal shows for your domain — enter exactly that.

We also use an upstream mail filter — does that change anything?

For OUTBOUND sending through the filter, its path must be in SPF and ideally signed with its own DKIM. Such chains (filter in front of Exchange) are error-prone — this is where a professional's look at the actual mail flow pays off.