Setting Up Email Authentication for Microsoft 365
Complete guide to configuring SPF, DKIM, and DMARC for Microsoft 365/Office 365. Includes step-by-step instructions for Exchange Online.
Setting Up Email Authentication for Microsoft 365
Microsoft 365 (formerly Office 365) requires proper email authentication configuration for optimal deliverability. This guide covers SPF, DKIM, and DMARC setup specifically for Microsoft 365.
Overview
Microsoft 365 automatically configures some authentication, but you need to:
- Verify SPF - Microsoft adds itself automatically, but you may need to add other services
- Enable DKIM - Must be manually enabled in Exchange Admin Center
- Configure DMARC - You publish this yourself in DNS
Prerequisites
- Microsoft 365 admin access
- Access to your domain's DNS settings
- Domain added to Microsoft 365
Step 1: Configure SPF for Microsoft 365
Microsoft's Default SPF
Microsoft automatically adds itself to your SPF when you add a domain, but you need to verify and potentially add other services.
Check Current SPF Record
- Go to Microsoft 365 Admin Center
- Navigate to Settings → Domains
- Select your domain
- View DNS records → Find SPF record
Or check DNS directly:
dig TXT yourdomain.comStandard Microsoft 365 SPF Record
v=spf1 include:spf.protection.outlook.com -allAdding Additional Services
If you use other email services alongside Microsoft 365:
v=spf1 include:spf.protection.outlook.com include:sendgrid.net include:servers.mcsv.net -allImportant: Microsoft 365's SPF includes multiple IP ranges. Don't try to flatten it manually.
Common Microsoft 365 SPF Includes
| Service | Include Statement |
|---|---|
| Microsoft 365 (default) | include:spf.protection.outlook.com |
| Exchange Online Protection | Already included in above |
| Microsoft Teams | Already included |
| Dynamics 365 | include:spf.dynamics.com |
DNS Configuration
Add or update TXT record:
| Field | Value |
|---|---|
| Type | TXT |
| Host/Name | @ or leave blank |
| Value | v=spf1 include:spf.protection.outlook.com -all |
| TTL | 3600 |
Step 2: Enable DKIM for Microsoft 365
Microsoft 365 uses CNAME records for DKIM, not TXT records like other providers.
Enable DKIM in Exchange Admin Center
-
Go to Microsoft 365 Defender Portal
- Navigate to: https://security.microsoft.com/dkimv2
- Or: Security → Email authentication → DKIM
-
Select your domain
-
Enable DKIM signing
-
Microsoft generates two selectors:
selector1._domainkey.yourdomain.comselector2._domainkey.yourdomain.com
Add CNAME Records to DNS
Microsoft provides CNAME records like:
selector1._domainkey CNAME selector1-yourdomain-com._domainkey.onmicrosoft.com
selector2._domainkey CNAME selector2-yourdomain-com._domainkey.onmicrosoft.com
DNS Configuration:
| Field | Value |
|---|---|
| Type | CNAME |
| Host/Name | selector1._domainkey |
| Value | selector1-yourdomain-com._domainkey.onmicrosoft.com |
| TTL | 3600 |
Repeat for selector2._domainkey.
Verify DKIM Setup
Method 1: Microsoft Admin Center
- Go back to DKIM settings
- Status should show "Enabled" with green checkmark
Method 2: Send Test Email
- Send email from Microsoft 365 account
- Check email headers
- Look for
DKIM-Signatureheader - Verify
d=matches your domain
Method 3: Online Tools
- Use MailSentinel to check DKIM records
- Use MXToolbox DKIM checker
DKIM Key Rotation
Microsoft automatically rotates DKIM keys:
- Keys rotate every few months
- CNAME records stay the same
- No manual intervention needed
Step 3: Configure DMARC for Microsoft 365
Microsoft doesn't configure DMARC automatically - you must do this yourself.
Get Your MailSentinel Report Address
- Log in to MailSentinel
- Go to Settings → DMARC Configuration
- Copy your report address:
your-org-id@reports.mailsentinel.io
Create DMARC Record
Starting with monitoring (recommended):
v=DMARC1; p=none; rua=mailto:your-org-id@reports.mailsentinel.io; ruf=mailto:your-org-id@forensic.mailsentinel.ioAfter monitoring period:
v=DMARC1; p=quarantine; rua=mailto:your-org-id@reports.mailsentinel.io; adkim=r; aspf=rFull enforcement:
v=DMARC1; p=reject; rua=mailto:your-org-id@reports.mailsentinel.io; ruf=mailto:your-org-id@forensic.mailsentinel.io; adkim=r; aspf=rAdd DMARC Record to DNS
| Field | Value |
|---|---|
| Type | TXT |
| Host/Name | _dmarc |
| Value | Your DMARC record |
| TTL | 3600 |
Verify DMARC Setup
- Use MailSentinel to check DNS
- Verify DMARC record is detected
- Wait 24-48 hours for first reports
- Monitor in MailSentinel dashboard
Microsoft 365 Specific Considerations
Shared Mailboxes
- Shared mailboxes use the same authentication
- No special configuration needed
- DMARC applies to all mailboxes
Distribution Lists
- Distribution lists don't send email directly
- Replies use the sender's authentication
- No special SPF/DKIM needed
External Forwarding
If you forward emails externally:
-
Enable ARC (Authenticated Received Chain)
- Helps preserve authentication through forwarding
- Configure in Exchange Admin Center
-
Update SPF if forwarding to external addresses
- May need to include forwarding server IPs
Hybrid Deployments
If using hybrid Exchange (on-premises + cloud):
- On-premises servers need their own SPF entries
- Add on-premises IPs to SPF:
v=spf1 include:spf.protection.outlook.com ip4:your-onprem-ip -all - Configure DKIM on on-premises if sending directly
- Ensure DMARC covers both environments
Microsoft Teams
Microsoft Teams emails:
- Use Microsoft 365 authentication
- Covered by your SPF/DKIM/DMARC
- No additional configuration needed
Troubleshooting Microsoft 365 Issues
Issue 1: SPF Too Permissive
Problem: Using +all or ?all instead of -all
Solution:
- Edit DNS TXT record
- Change to
-all - Verify in Microsoft Admin Center
Issue 2: DKIM Not Signing
Symptoms:
- No DKIM signature in headers
- DKIM status shows "Not enabled"
Solutions:
- Verify DKIM is enabled in Security Center
- Check CNAME records are published correctly
- Wait 15-60 minutes for DNS propagation
- Verify domain is fully configured in Microsoft 365
Issue 3: DMARC Failures
Symptoms:
- DMARC reports show failures
- Emails going to spam
Common Causes:
-
SPF alignment issues
- Envelope sender doesn't match From: domain
- Check Return-Path header
-
DKIM alignment issues
- DKIM signing domain doesn't match From: domain
- Microsoft signs with your domain, so this is usually fine
-
Third-party senders
- Services sending as your domain not in SPF
- Add missing services to SPF
Issue 4: Multiple SPF Records
Problem: Multiple SPF TXT records exist
Solution:
- Find all SPF records:
dig TXT yourdomain.com | grep "v=spf1" - Merge into single record
- Remove duplicates
Issue 5: DKIM CNAME Not Working
Symptoms:
- CNAME records not resolving
- DKIM validation fails
Solutions:
- Verify CNAME syntax is correct
- Check for typos in hostname
- Ensure no conflicting TXT records
- Wait for DNS propagation
Microsoft 365 Bulk Sender Requirements (2025)
Starting May 2025, Microsoft enforces requirements for bulk senders:
Requirements
- SPF and DKIM - Both required
- DMARC Policy - Must publish DMARC (minimum
p=none) - DMARC Alignment - From: domain must align with SPF or DKIM
- One-Click Unsubscribe - Required for marketing emails
- Spam Rate - Keep below 0.3%
Compliance Checklist
- SPF record includes
spf.protection.outlook.com - DKIM enabled and CNAME records published
- DMARC record published (start with
p=none) - DMARC reports being received
- SPF alignment verified
- DKIM alignment verified
- List-Unsubscribe headers configured
- Spam complaint rate monitored
Best Practices for Microsoft 365
1. Start with Monitoring
Begin with p=none DMARC policy:
- Monitor for 2-4 weeks
- Identify all sending sources
- Fix alignment issues
- Then move to enforcement
2. Use MailSentinel for Monitoring
- Set up DMARC reporting to MailSentinel
- Monitor SPF/DKIM pass rates
- Get alerts for authentication failures
- Track progress toward enforcement
3. Regular Audits
Review quarterly:
- SPF record for unused services
- DKIM signing status
- DMARC report data
- Alignment issues
4. Document Configuration
Keep records of:
- SPF includes and why
- DKIM selector status
- DMARC policy progression
- Any custom configurations
5. Test Before Changes
- Use test subdomain first
- Send test emails
- Verify headers
- Check DMARC reports
- Then apply to production
Common Microsoft 365 Configurations
Small Business (Microsoft 365 Only)
SPF:
v=spf1 include:spf.protection.outlook.com -allDKIM: Enable in Security Center
DMARC:
v=DMARC1; p=none; rua=mailto:your-org-id@reports.mailsentinel.ioEnterprise (Microsoft 365 + Marketing Platform)
SPF:
v=spf1 include:spf.protection.outlook.com include:servers.mcsv.net -allDKIM: Enable Microsoft 365 DKIM + configure marketing platform DKIM
DMARC:
v=DMARC1; p=quarantine; rua=mailto:your-org-id@reports.mailsentinel.io; adkim=r; aspf=rHybrid (On-Premises + Microsoft 365)
SPF:
v=spf1 include:spf.protection.outlook.com ip4:203.0.113.0/24 -allDKIM: Enable for Microsoft 365, configure separately for on-premises
DMARC: Same as above, covers both environments
Next Steps
After configuring Microsoft 365 authentication:
- Monitor DMARC Reports - Track authentication status
- Set Up Alerts - Get notified of issues
- Review SPF Validation - Check lookup count
- Progressive DMARC Enforcement - Move toward
p=reject
Additional Resources
- Microsoft 365 Email Authentication - Microsoft's official guide
- DKIM Configuration - DKIM setup guide
- SPF Setup - SPF configuration
- DMARC Setup - DMARC configuration