Xpoudy

How to Set Up Microsoft 365 DKIM in Cloudflare

Short answer

Copy both DKIM CNAME targets from your Microsoft 365 domain’s DKIM page. Add them as DNS-only CNAMEs in Cloudflare for selector1 and selector2. Once both resolve, enable DKIM for the domain in Microsoft Defender and check a new message for a valid aligned signature.

By Xpoudy ·

Copy both tenant-specific destinations

In Microsoft Defender, open the DKIM settings and select the custom domain that appears in your outbound From address. If Microsoft needs to create keys for the domain, follow the prompt and copy both CNAME pairs. Microsoft can issue different target patterns. Copy the current values for your own tenant without reconstructing them from somebody else’s example.

Enter the two CNAMEs in Cloudflare

Open the authoritative Cloudflare zone at DNS → Records. Use the selector names as provided and set each record to DNS only. For a root domain, the usual name inputs look like this.

TypeNameTargetProxy
CNAMEselector1._domainkeyFirst CNAME target from Microsoft DefenderDNS only
CNAMEselector2._domainkeySecond CNAME target from Microsoft DefenderDNS only

If you are configuring a sending subdomain, double-check the names and zone before saving. If an obsolete record already occupies a selector name, identify the live signer and coordinate the replacement. A CNAME at a name cannot coexist with TXT data at that same name.

Enable signing and validate a message

Run the Xpoudy DKIM checker for both selectors. Compare the public aliases with Microsoft’s exact targets. Return to Microsoft Defender to enable DKIM. Send from the fully qualified custom domain to a test mailbox, then inspect its headers and check for a passing signature with the expected signing domain. A signature using the tenant’s default domain may still be valid but may fail alignment with your custom From domain.