Blazalek.com

How to set up SPF, DKIM and DMARC for a Microsoft 365 domain

Authenticating custom domains in Microsoft 365 involves reconciling SPF records, configuring two DKIM CNAME selectors, publishing a DMARC policy, and proving aligned results on external messages.

By

On this page

To set up SPF, DKIM, and DMARC for a Microsoft 365 domain, you configure SPF, activate DKIM for the custom domain, and verify an authentic message delivered to an outside recipient. Only then can you treat the sending domain as verified. The procedure assumes an existing Microsoft 365 sending tenant and control of that domain’s DNS. It covers outgoing authentication only; mailbox migration and Outlook.com recipient requirements are separate tasks.

I checked the Microsoft 365 setup instructions in this guide against Microsoft’s documentation on 10 September 2026.

Establish the starting point

Write down the actual From and envelope sender domains, the specific Microsoft cloud environment, your DNS provider, and the outbound path you intend to test. Save the current DNS values and signing configuration so you can compare them later. Your sender inventory should account for mailboxes, applications, relays, hybrid servers, and outside services, because your SPF record must retain every approved sender (Microsoft SPF source syntax).

Make sure you have access to edit your domain’s public DNS records (DNS editing requirements). In an authorized Exchange Online PowerShell session, run Get-AcceptedDomain and look for your domain (accepted-domain prerequisite). If the domain is not listed, pause and complete Microsoft’s domain ownership verification procedure first; adding a domain requires Domain Name Administrator access (domain administration prerequisite).

Have an authorized Exchange administrator use the cmdlet-and-parameter permission lookup for Get-AcceptedDomain, Get-DkimSigningConfig, New-DkimSigningConfig with DomainName,Enabled, and Set-DkimSigningConfig with Identity,Enabled, and check which of the returned roles and assignments apply to the account that will run these commands (interpret role assignments). The lookup has its own access requirements, and being able to run it does not by itself establish permission to configure DKIM (permission-lookup prerequisites). If the required access is missing, stop here.

Which SPF record is right for Microsoft 365?

A domain publishes exactly one SPF policy; other TXT records can share the name (SPF policy publication), but publishing multiple SPF records triggers an immediate permerror (SPF record selection). Preserve every sender already approved, and keep the policy within the ten-term limit for mechanisms and modifiers requiring DNS lookups during evaluation (SPF evaluation limit). If keeping every sender pushes the combined policy over that limit, the guide chapter on staying under the SPF lookup limit covers the options.

The value that follows is a synthetic illustration, not a performed test. If Microsoft 365 is the only outbound sender for your domain in a commercial or GCC cloud, the complete SPF value is: v=spf1 include:spf.protection.outlook.com -all. Other Microsoft clouds use different values (Microsoft-only SPF scenario). If your sender list is incomplete, finish the inventory before you change SPF, because a receiver may reject an SPF -all failure before it evaluates DMARC at all (early SPF rejection).

Publishing the two DKIM selector CNAMEs from PowerShell

Open an Exchange Online PowerShell window and run:

Get-DkimSigningConfig | Format-List Name,Enabled,Status,Selector1CNAME,Selector2CNAME

Locate the entry for your accepted domain. Only if no configuration exists, create a disabled object and re-query the values. Use your accepted sending domain in place of the reserved example.com; no command in this guide has been run against a tenant:

New-DkimSigningConfig -DomainName example.com -Enabled $false

An existing configuration does not need to be re-created (conditional DKIM creation). Copy the targets the tenant actually returns; do not reconstruct them from another domain’s records (tenant-generated DKIM values).

For the synthetic domain example.com, publish two CNAME records, adapting the owner names to your own domain (selector fields and DNS records).

Full DNS owner name in this exampleTarget value to enter
selector1._domainkey.example.comCopy the complete Selector1CNAME value returned for your sending domain.
selector2._domainkey.example.comCopy the complete Selector2CNAME value returned for your sending domain.

If your DNS control panel appends the root zone automatically, supply only the relative host prefix such as selector1._domainkey (CNAME owner-name format), and follow your DNS host’s requirements regarding trailing dots on target names (trailing-dot handling).

After publishing both records, allow time for Microsoft to detect them in DNS. For the same synthetic domain, enable signing by running:

Set-DkimSigningConfig -Identity example.com -Enabled $true

If detection fails, correct the reported DNS discrepancy, wait and retry. Once the command succeeds, rerun the configuration query; the expected values are Enabled: True and Status: Valid (DNS detection, enablement and status checks). Note that each sending subdomain requires its own independent DKIM setup (sending-subdomain configuration).

DMARC monitoring for a Microsoft 365 domain

When deploying DMARC, finish SPF and DKIM setup first (Microsoft authentication setup order). Set up a reporting mailbox or automated DMARC service so your team can monitor aggregate reports (prepare aggregate-report reception).

Check for any existing DMARC policy before editing DNS. If you don’t already have a DMARC policy, start in monitoring mode (do not downgrade to p=none if you are already enforcing quarantine or reject): v=DMARC1; p=none; rua=mailto:dmarc@example.com. Replace the address with your functioning report destination (publish a monitoring policy) and publish the value as TXT at _dmarc.example.com, adapted to your domain (DMARC TXT record name).

Creating a mailbox on its own isn’t enough; arrange report processing, preferably with a parser, and compare the reported streams with your inventory (process aggregate reports). Resolve legitimate authentication failures before you introduce enforcement (correct legitimate failures).

Prove the result on an external message

Once DNS changes propagate, send a test message through Microsoft 365 to an external mailbox outside your organization. Inspect the message’s visible From, the DKIM signature’s d= and s= tags, and the receiving server’s authentication summary. Internal mail may omit DKIM, so an internal test message cannot complete this check (external-message verification).

Rely on Authentication-Results only when you can attribute it to the receiving system’s trusted authentication boundary (authentication-result trust boundary); the text of a copied header is not enough evidence on its own (authentication-header integrity).

For DMARC, DKIM contributes the d= domain it validated (DKIM identity for DMARC), and SPF contributes the MAIL FROM domain it validated (SPF identity for DMARC). At least one of these authenticated identities must align with the domain in the From header for DMARC to pass (DMARC pass rule). An exact domain match meets both strict and relaxed alignment (alignment modes).

The examples below are synthetic scenarios showing expected evaluations rather than live mailbox logs. Assume From: operator@example.com, an active DMARC policy, and no additional authenticated identifiers beyond those listed.

Evidence availableWhat it establishesNext action
Trusted dkim=pass header.d=example.com and dmarc=pass header.from=example.comThe message has a passing aligned DKIM identity.Save the headers and route; check the other inventoried routes.
One selector is absent or differs from the tenant output; the configuration is not validDNS does not yet match the required configuration.Correct that record and retry after detection.
DKIM and SPF pass only for unrelated example.net identitiesNeither passing identity aligns with example.com.Correct the intended sender-domain configuration before continuing the rollout.
Only an internal message or unattributed authentication headers are availableExternal authentication remains unproven.Obtain a fresh external sample from the intended route.

The alignment rows follow the DMARC pass rule; the DNS row follows Microsoft’s DNS detection, enablement and status checks. For an in-depth breakdown of identifiers, work through DMARC alignment.

Keep DNS records, configuration, and message evidence together. When legitimate mail fails, pause the rollout, correct the configuration responsible, and retest (correct legitimate failures). If an authentication error persists without an obvious fix, identify the failed Microsoft 365 authentication check.

Disabling custom domain signing removes that signature (effect of disabling custom-domain signing). Reserve deactivation for active incident triage, and only after verifying the remaining aligned authentication path under the DMARC pass rule; it is not a routine recovery step.

Microsoft’s private keys are inaccessible, so this procedure cannot promise to restore an earlier key (Microsoft-managed key access).

Valid authentication does not promise inbox placement on its own, because receiving mailbox providers retain final discretion over message delivery (receiver handling discretion).

Frequently asked questions

Is v=spf1 include:spf.protection.outlook.com -all enough for my domain?

Only when Microsoft 365 is the sole platform sending mail for your domain in a commercial or GCC cloud. If your company uses marketing tools, ticketing desks, or on-premises relays, combine every approved source into one record rather than dropping existing entries.

Do I need to run New-DkimSigningConfig?

Only if PowerShell shows no configuration object for your accepted domain. When the domain already returns selector records, skip creation and publish the displayed CNAME targets directly in DNS.

What should Get-DkimSigningConfig show after I enable signing?

The command should return Enabled: True and Status: Valid. If the status stays invalid, check whether your CNAME targets match Microsoft’s exact hostnames and allow time for tenant detection.

Does each sending subdomain need its own DKIM configuration?

Yes. Each sending subdomain requires its own distinct DKIM configuration and its own pair of CNAME records. Query PowerShell for each specific hostname rather than duplicating values from your root domain.

Can I verify DKIM with an internal message?

No. Internal mail may omit DKIM, so an internal sample cannot complete this check. Send a fresh test email to an external mailbox and inspect the Authentication-Results header there.

Email deliverability consultant

Get a second opinion on your email setup

Tell me what your customers are seeing or what you’re planning to change. In 30 minutes, we’ll work out what your team can check first and whether a deliverability audit would help.

I led deliverability at GetResponse, designed a dedicated newsletter system for Easy.Tools and helped Youmoney migrate its automated emails in stages. Read the case studies

Book free call

Email deliverability audit

See what I check and read a sample report with recommendations for your team.