Authentication is a mail-flow project, not a DNS task
A Microsoft 365 tenant can have a correct-looking SPF record and still leave its domain easy to spoof. SPF authenticates the domain used in the SMTP envelope, DKIM associates a signing domain with message content, and DMARC tests whether at least one passing mechanism aligns with the domain visible to the recipient in the From header. The deployment succeeds only when the organization understands all three identities and every system that sends on its behalf.
Start with a sender register, not a proposed TXT record. Include Exchange Online, on-premises relays, multifunction printers, line-of-business applications, ticketing systems, customer relationship platforms, payroll services, marketing platforms, website forms, and any vendor that sends invoices or alerts using your domain. Record the visible From domain, envelope domain, DKIM signing domain, sending service owner, expected volume, and a named business contact. Microsoft specifically recommends using a subdomain for services outside your direct control so their configuration and reputation do not affect normal employee mail.
The target state is measurable: every authorized stream passes DMARC through aligned DKIM, aligned SPF, or both; unauthorized use is rejected; and aggregate reports are reviewed. Authentication improves resistance to direct domain spoofing, but it does not certify that a message is harmless, prevent look-alike domains, or guarantee inbox placement. Keep anti-phishing, malware, safe-link, and user-verification controls in place.
Build a baseline before changing DNS
Export the accepted domains from Microsoft 365 and reconcile them with the organization's registrar and DNS inventory. Classify each domain as active for human mail, active for application or bulk mail, inbound-only, or parked. Repeat the exercise for subdomains: an SPF record on example.ca does not authorize marketing.example.ca, while a parent DMARC policy can apply to subdomains that do not publish their own DMARC record.
Publish a monitoring DMARC record before enforcement if the domain has no reporting. A typical starting point is v=DMARC1; p=none; rua=mailto:dmarc-aggregate@example.ca. Use a dedicated, access-controlled mailbox or reporting service because XML reports can be numerous and reveal sending infrastructure. Confirm that the reporting destination accepts reports; an external reporting domain may need an authorization record. Do not treat p=none as an end state—it gathers evidence but does not request quarantine or rejection.
Observe at least one complete business cycle and longer where monthly systems exist. Group reports by source IP, header From domain, envelope domain, DKIM d= domain, disposition, and volume. For each failure, decide whether it is an unauthorized sender, an authorized sender needing alignment work, or a legitimate forwarding path. Do not add an IP or vendor include merely because it appears in a report; obtain ownership confirmation and a current vendor configuration reference.
Make SPF small, specific, and supportable
A common Microsoft 365-only record is v=spf1 include:spf.protection.outlook.com -all. That example is not a universal answer: add only sources that actually use the domain in the envelope sender. RFC 7208 limits the DNS-querying terms used during an SPF evaluation to ten. Nested vendor includes consume that budget, so count the complete evaluation path rather than the visible number of include terms.
Publish one SPF record per name. Multiple v=spf1 records cause a permanent error rather than combining permissions. Avoid broad ip4 ranges and the ptr mechanism. If the record approaches the lookup limit, move bulk senders to dedicated subdomains, ask vendors for a custom return-path, or deliberately flatten only with an owner, automated change detection, and a documented refresh schedule. A stale flattened record can silently authorize old infrastructure or block new infrastructure.
Validate from multiple public resolvers after the DNS change. Send samples from every stream to test recipients outside Microsoft 365 and inspect Authentication-Results and Return-Path. A raw spf=pass result is not enough for DMARC; confirm that smtp.mailfrom aligns with header.from. Preserve the previous TXT value and DNS time-to-live so rollback is a single controlled record change.
- example.ca (TXT): v=spf1 include:spf.protection.outlook.com -all — Example for a domain whose only envelope sender is Microsoft 365; inventory before use.
Enable DKIM for every active custom sending domain
Microsoft automatically signs mail for the tenant's onmicrosoft.com domain, but custom-domain DKIM requires configuration. In Microsoft 365, publish the two CNAME targets shown for the domain in the Defender portal or Exchange Online PowerShell, wait for public resolution, then enable signing. Copy the exact targets generated for the tenant; do not derive or reuse values from an example because Microsoft has documented more than one target format.
After activation, send a new message from the custom domain and inspect its headers. Confirm dkim=pass, that header.d is the custom organizational domain or an aligned subdomain, and that dmarc=pass. Test connectors, relays, and applications separately. A message can carry more than one DKIM signature, and a valid vendor signature does not satisfy DMARC when its d= domain is unrelated to the visible From domain.
Treat DKIM rotation as an operational process. Microsoft provides two selectors so keys can rotate without a signing outage. Record who reviews selector health, how often rotation is initiated, how long old DNS is retained, and what evidence closes the change. If enabling custom signing breaks a mail path, disable signing for that domain while keeping the CNAME records, investigate message modification or routing, and retest before re-enabling.
Move DMARC from observation to enforcement
DMARC passes when aligned SPF or aligned DKIM passes. Prefer aligned DKIM as the durable path for third-party senders because forwarding often changes the connecting server and can break SPF, while an unmodified DKIM signature can survive. Configure vendors to sign with your domain or a subdomain you control. Where a service cannot align, move it to a clearly named vendor-specific subdomain or replace it; permanent exceptions turn the monitoring phase into policy debt.
Advance only on evidence. Establish acceptance criteria such as: all business-owned streams identified; no unexplained high-volume source; test messages from every critical stream pass DMARC; forwarding scenarios are understood; and support has a rollback owner. Move to p=quarantine, review aggregate reports and help-desk signals, then move to p=reject. Use the subdomain policy tag sp= deliberately rather than assuming all descendants should behave like the parent.
A production record might be v=DMARC1; p=reject; sp=reject; rua=mailto:dmarc-aggregate@example.ca; adkim=r; aspf=r. Relaxed alignment is the protocol default and is normally practical; strict alignment should be chosen only after testing. The pct tag can stage enforcement under RFC 7489, but a percentage rollout is not a substitute for classifying failures, and BIMI programs generally require enforcement across all mail rather than partial policy.
- _dmarc.example.ca (TXT): v=DMARC1; p=none; rua=mailto:dmarc-aggregate@example.ca — Stage: observe
- _dmarc.example.ca (TXT): v=DMARC1; p=quarantine; sp=quarantine; rua=mailto:dmarc-aggregate@example.ca — Stage: controlled enforcement
- _dmarc.example.ca (TXT): v=DMARC1; p=reject; sp=reject; rua=mailto:dmarc-aggregate@example.ca — Stage: target state
Validate in headers and preserve a rollback path
For each stream, retain a redacted header sample that proves the expected result. Read the Authentication-Results field added by the receiving service: look for spf, dkim, and dmarc results plus the domains each result evaluated. Also confirm the visible From, Return-Path, and DKIM-Signature d= value. A web-based checker is useful for syntax, but it cannot prove the path taken by a real invoice, alert, or campaign.
Monitor after each policy change for at least the agreed observation window. Track DMARC pass rate by known source, unknown-source volume, user-reported non-delivery, vendor ticket volume, and DNS errors. Define a stop condition before the change—for example, failure of a payroll or customer-notification stream—and keep the exact previous record in the change ticket.
Rollback means restoring the previous DMARC policy while the root cause is corrected, not adding a broad permanent allow. SPF and DKIM changes should also have discrete reversions. Lower DNS TTL ahead of the maintenance window if rapid reversal is necessary, then restore the normal TTL after stability is proven. Document exceptions with an expiry date and owner.
Inbound Microsoft 365 considerations
Outbound authentication protects domains you control. Inbound Microsoft 365 protection also evaluates SPF, DKIM, DMARC, and other signals. Do not create transport rules that broadly bypass spam or authentication checks for a partner or appliance. Scope any connector or allow decision to independently verifiable attributes and review it periodically.
Mailing lists, secure email gateways, and other intermediaries can modify signed content or alter the delivery path. Microsoft supports trusted ARC sealers for known services that preserve original authentication results. Trust only services you have validated; ARC is not a reason to accept arbitrary upstream claims. Troubleshoot with message headers and message trace before changing policy.
Implementation checklist
- Inventory every accepted domain, sending subdomain, and authorized mail stream with a business owner.
- Classify parked and inbound-only domains and publish deny-oriented SPF and DMARC where appropriate.
- Publish DMARC aggregate reporting and classify observed sources before enforcement.
- Maintain exactly one SPF record per sending name and verify the full DNS-lookup budget.
- Enable Microsoft 365 custom-domain DKIM using the exact tenant-generated CNAME targets.
- Prove SPF and DKIM alignment from a real message for every critical sender.
- Advance DMARC through monitor, quarantine, and reject only against written acceptance criteria.
- Store pre-change DNS values, stop conditions, rollback owner, and observation window in the change record.
- Review aggregate reports and expired exceptions on a recurring schedule.
- Test forwarding and trusted ARC paths without broad authentication bypasses.
Sources and further reading
- Email authentication in cloud organizations
- Set up SPF to identify valid email sources for your custom cloud domains
- Set up DKIM to sign mail from your cloud domain
- Set up DMARC to validate the From address domain for cloud senders
- Configure trusted ARC sealers
- RFC 7208: Sender Policy Framework (SPF)
- RFC 6376: DomainKeys Identified Mail (DKIM) Signatures
- RFC 7489: Domain-based Message Authentication, Reporting, and Conformance