Before you start
You need access to DNS for the domain and an administrator role in Microsoft 365. Make a list of every service that sends email with your domain in the From address: newsletters, invoicing, website, scanners. They must be part of the setup too.
Step 1: SPF
v=spf1 include:spf.protection.outlook.com -allMicrosoft recommends -all for domains in Microsoft 365, because they also recommend DKIM and DMARC. The domain can only have one SPF record. If other services send for the domain, you add them to the same record, before -all.
SPF allows at most 10 DNS lookups. If you have many services, see the guide to the SPF limit.
Step 2: DKIM
Microsoft uses two selectors, selector1 and selector2, and switches between them when the keys are renewed. You create two CNAME records that point to Microsoft. The values are different for every customer, so get them from the portal and not from an example.
- Open
security.microsoft.com/authentication, or go to Email & collaboration, Policies & rules, Threat policies, Email authentication settings, and choose the DKIM tab. - Select the domain. Under "Publish CNAMEs" you find the two records to create.
- Add
selector1._domainkeyandselector2._domainkeyas CNAME at your DNS provider. - Wait a few minutes, and turn on "Sign messages for this domain with DKIM signatures".
| The domain was added | The CNAME record points to |
|---|---|
| Before May 2025 | selector1-company-com._domainkey.company.onmicrosoft.com |
| From May 2025 | selector1-company-com._domainkey.company.n-v1.dkim.mail.microsoft |
The letter before -v1 varies and cannot be chosen. You can also get the values with PowerShell: Get-DkimSigningConfig -Identity company.com | Format-List Selector1CNAME,Selector2CNAME.
Check the key length with the DKIM key strength tool. If the key is 1024 bits, you move to 2048 bits with Rotate-DkimSigningConfig -Identity company.com -KeySize 2048.
Step 3: DMARC
v=DMARC1; p=none; rua=mailto:dmarc@company.comStart with p=none, read the reports, and tighten. The goal Microsoft sets is p=reject for all custom domains and subdomains. The method is in the guide to DMARC policy.
Do not forget the onmicrosoft.com domain
Every customer has a domain that ends in onmicrosoft.com. It can be abused too. Microsoft recommends a DMARC record with reject for it, and you add it in the Microsoft 365 admin center under Settings, Domains, select the onmicrosoft.com domain, DNS records, Add record.
v=DMARC1; p=rejectReports from Microsoft
Microsoft 365 sends aggregate reports to the address in rua for domains where the MX record points directly to Microsoft 365. Microsoft 365 does not send failure reports (ruf).
Check the setup
Use the SPF checker, the DKIM checker and the DMARC checker, or send an email to the email deliverability test, which shows whether SPF, DKIM and DMARC passed for a real email.