DNS Records Required for Microsoft 365 (Complete Setup Guide)
Complete guide to Microsoft 365 DNS records including MX, SPF, CNAME, DKIM, and DMARC. Includes real record examples and migration best practices.
Tools For This Topic
Why Microsoft 365 needs multiple DNS records
A Microsoft 365 deployment relies on multiple DNS record types to support email delivery, domain verification, client connectivity, and email authentication.
Mail flow (Exchange Online), service discovery (Autodiscover), and security controls (SPF, DKIM, DMARC) all depend on DNS being configured correctly.
Microsoft provides official DNS setup guidance.
Because of these dependencies, partial or incorrect DNS changes can result in mail delivery failures, login issues, or inconsistent client behaviour.
Common record types involved
- MX record for inbound email routing to Exchange Online
- TXT record for domain verification (MS=msXXXXXXXX)
- TXT record for SPF (authorising Microsoft 365)
- CNAME records for services such as autodiscover
- DKIM records for email signing
- DMARC record for policy enforcement and reporting
A typical Microsoft 365 MX pattern
Microsoft 365 uses a tenant-specific MX record that routes mail through Exchange Online Protection.
The MX record typically follows this format:
0 yourdomain-com.mail.protection.outlook.comThe exact hostname is unique to your tenant and must match the value provided in the Microsoft 365 admin portal.
Leaving legacy MX records in place alongside this record can cause split delivery or inconsistent routing.
TXT records in Microsoft 365
TXT records serve two main purposes in Microsoft 365: domain verification and SPF.
Domain verification records typically look like:
MS=ms12345678SPF records define which servers can send email on behalf of the domain. A standard Microsoft 365 SPF record is:
v=spf1 include:spf.protection.outlook.com -allOnly one SPF record should exist. If multiple SPF records are published, SPF evaluation will fail with a PermError.
CNAME records and service functionality
CNAME records are used to support Microsoft 365 services such as Autodiscover, which allows Outlook and other clients to automatically configure mail profiles.
autodiscover.example.com CNAME autodiscover.outlook.comIf this record is missing or incorrect, users may experience login prompts, connection failures, or manual configuration requirements.
Additional CNAME records may be required depending on services in use such as Teams or device management.
DKIM configuration in Microsoft 365
DKIM is used to sign outgoing emails, allowing receiving servers to verify authenticity.
Microsoft 365 requires two CNAME records for DKIM, but the exact target values should be copied from the Defender portal or Exchange Online PowerShell for your domain.
selector1._domainkey.example.com CNAME <selector1-cname-from-microsoft-365>
selector2._domainkey.example.com CNAME <selector2-cname-from-microsoft-365>That matters because Microsoft introduced an updated DKIM target format for some custom domains in May 2025. Older examples that always point into the tenant's onmicrosoft.com namespace are no longer universally correct.
After publishing these records, DKIM must be enabled within Microsoft 365, and the live CNAME answers should match the exact values Microsoft provided.
DMARC configuration
DMARC builds on SPF and DKIM to define how receiving servers should handle authentication failures.
_dmarc.example.com TXT "v=DMARC1; p=none; rua=mailto:dmarc@example.com"Policies can be gradually strengthened from monitoring to enforcement as confidence increases.
What to check during setup or migration
- Verification TXT record is present and correct
- MX record matches the Microsoft 365 tenant value exactly
- SPF includes spf.protection.outlook.com and does not exceed lookup limits
- Autodiscover CNAME is configured correctly
- No legacy MX or SPF records remain from previous providers
- DKIM records are published and enabled
- DMARC record is present and aligned with policy requirements
Common mistakes
- Leaving old MX records active alongside Microsoft 365
- Publishing multiple SPF records instead of merging them
- Forgetting to configure autodiscover CNAME
- Adding DKIM records but not enabling signing in Microsoft 365
- Skipping DMARC configuration
- Assuming migration is complete without testing mail flow and authentication
How to validate your Microsoft 365 DNS setup
After configuring DNS, validation is essential to ensure everything is working correctly.
Start by checking MX, TXT, and CNAME records using a DNS lookup tool.
Send a test email and review message headers to confirm SPF, DKIM, and DMARC all pass.
A properly configured environment should result in consistent mail delivery and aligned authentication results.
Use These DNS Pro Tools
If you want to validate this topic in practice, these DNS Pro tools are the fastest next step.
Related Tools
Related Articles
DNS Records Required for Google Workspace (Complete Setup Guide)
Complete guide to Google Workspace DNS records including MX, SPF, DKIM, DMARC, and domain verification. Includes real record examples and setup best practices.
How to Check Microsoft 365 DNS
A practical guide to checking Microsoft 365 DNS records, including MX, autodiscover, SPF, DKIM, DMARC, and the signs of an incomplete migration.
Microsoft 365 SPF, DKIM, and DMARC Setup
A practical guide to setting up SPF, DKIM, and DMARC for Microsoft 365, including the DNS records to publish and the checks to run after setup.
