The DKIM records for Microsoft 365
Microsoft 365 uses two selectors, selector1 and selector2, and publishes the keys on its side rather than yours: you create two CNAME records pointing to Microsoft. That lets Microsoft swap keys without you touching DNS; only one of the two selectors is active at a time.
The CNAME target depends on when the domain was added. For domains added since May 2025 the targets end in dkim.mail.microsoft, older domains keep the format with onmicrosoft.com. The Defender portal shows the exact values for the domain; guessing or copying from another tenant does not work.
As long as DKIM is not enabled, mail from the custom domain gets no DKIM signature according to Microsoft. The key is 1024 bits by default; you switch to 2048 bits in PowerShell with Rotate-DkimSigningConfig, and the rotation takes four days.
selector1._domainkey CNAME selector1-example-com._domainkey.example.n-v1.dkim.mail.microsoft
selector2._domainkey CNAME selector2-example-com._domainkey.example.n-v1.dkim.mail.microsoftHow to set up DKIM for Microsoft 365
The steps in the Microsoft 365 admin interface and at the DNS host:
- In the Microsoft Defender portal open “Email & collaboration”, “Policies & rules”, “Threat policies” and then “Email authentication settings”, and switch to the “DKIM” tab.
- Select the domain and choose “Create DKIM keys”; the portal shows the two CNAME records with their targets.
- Create both CNAMEs at the DNS host: selector1._domainkey and selector2._domainkey, each with the target shown.
- Back in the portal enable “Sign messages for this domain with DKIM signatures”. If the portal reports “CnameMissing”, the records are not visible yet; it takes a few minutes or longer for Microsoft to detect them.
Click path at Microsoft 365
Publishing at the DNS host
DKIM records always live at selector._domainkey. Most DNS editors append the domain themselves, so you only enter the part before it. CNAME records for DKIM must not sit behind a proxy. The guides per host below show where the record is created in the respective DNS editor.
Verify and keep an eye on it
The DKIM checker below queries the key under the selector and checks structure and length. You see whether the records for Microsoft 365 are publicly visible. DomainWarn keeps checking them afterwards and alerts you when a key disappears or changes.