To set up DKIM in Microsoft 365, open Email authentication settings in the Microsoft Defender portal, select your custom domain on the DKIM tab, and copy the two CNAME records Microsoft generates (selector1._domainkey and selector2._domainkey). Add both at your DNS host, wait for Microsoft to detect them, then turn on signing. A test email should then show dkim=pass in its headers.
DKIM puts a digital signature on the email your business sends, so the receiving server can check that a message came from your domain and wasn't changed on the way. Microsoft 365 signs mail from your onmicrosoft.com address on its own. For a custom domain like yourbusiness.com, Microsoft says no DKIM signing happens until you set it up. (What is DKIM?)
The hands-on part is short. Most of the time goes to waiting for DNS changes to show up. You'll need a Microsoft 365 admin account and the login for your DNS host, which is often the company you bought the domain from.
Here are the steps at a glance:
- Open the DKIM tab in the Microsoft Defender portal and select your domain.
- Copy the two CNAME values Microsoft generates for you.
- Add both CNAME records at your DNS host.
- Turn on DKIM signing once Microsoft detects the records.
- Send a test email and check its headers for
dkim=pass.
Why do I need to set up DKIM in Microsoft 365?
RFC 6376, the DKIM standard, describes it as a way for the organization that owns a domain to claim some responsibility for a message. For your business, that domain should be yourbusiness.com, the one your customers see.
DKIM matters most because of DMARC, the record that tells other providers what to do with fake mail from your domain. Microsoft explains that a DKIM signature only counts toward DMARC when the signing domain matches the domain in your From address. Until you set up DKIM for yourbusiness.com, your mail has no signature that matches.
DKIM also survives situations that break SPF. When a mailing list or another server relays your message, SPF often fails, while the current DMARC standard, RFC 9989, notes that DKIM signatures generally stay valid. The same standard says a domain that publishes p=reject must not rely on SPF alone to pass DMARC, which in practice means signing its mail with DKIM.
If you plan to move DMARC past monitoring mode, do this step first.
What DNS records does Microsoft 365 DKIM use?
Microsoft 365 uses two CNAME records rather than the TXT record some other providers use. Each one points to a public key that Microsoft hosts, which lets Microsoft rotate your keys without you touching DNS again. Only one of the two (called selectors) signs mail at a time. The other is used after the next key rotation.
The record names are the same for everyone. The values are unique to your account, so the table below shows a placeholder pattern only. Don't type these in; copy your real values from the Defender portal in the next step.
- TypeCNAMEName / Hostselector1._domainkeyValueselector1-yourbusiness-com._domainkey.TENANT.X-v1.dkim.mail.microsoftPlaceholder, not a real value. Copy the exact selector1 value from the Defender portal.
- TypeCNAMEName / Hostselector2._domainkeyValueselector2-yourbusiness-com._domainkey.TENANT.X-v1.dkim.mail.microsoftPlaceholder, not a real value. Copy the exact selector2 value from the Defender portal.
The placeholder follows Microsoft's published pattern:
yourbusiness-comis your domain with each dot changed to a dash.TENANTis the first part of your onmicrosoft.com address. For yourbusiness.onmicrosoft.com, it would be yourbusiness.Xis a single letter, such as r or n, that Microsoft assigns. You can't choose it or work it out yourself, which is why copying beats typing.
Microsoft introduced this format for new custom domains in May 2025. Domains set up before then keep the older format, which ends in your onmicrosoft.com address instead, such as selector1-yourbusiness-com._domainkey.yourbusiness.onmicrosoft.com. Use whichever format the portal shows you.
Where do I find my DKIM values in the Defender portal?
For a domain that has never had DKIM keys, Microsoft's process shows an error message partway through. You can safely dismiss it. The full sequence is:
- In the Microsoft Defender portal (security.microsoft.com), go to Email & collaboration → Policies & rules → Threat policies → Email authentication settings. You can also go straight to security.microsoft.com/authentication.
- Select the DKIM tab and find the row for your custom domain. Its toggle should read Disabled and its status
NoDKIMKeys. - Slide the toggle to Enabled. Microsoft can't start signing yet, so a Client error dialog opens. That's expected. It lists your CNAME values, but they're easier to copy in a moment, so select OK.
- The status changes to
CnameMissing. Click anywhere in the domain's row, except the check box or the toggle, to open its details. - In the Publish CNAMEs section, note both values or select Copy. Leave this panel open in its own browser tab.
If your domain isn't on the list, it hasn't been added to Microsoft 365 yet. Follow Microsoft's instructions to add the domain first, then come back to this step.
If you're comfortable with Exchange Online PowerShell, this command shows the same two values:
Get-DkimSigningConfig -Identity yourbusiness.com | Format-List Selector1CNAME,Selector2CNAME
How do I add the CNAME records at my DNS host?
In a second browser tab, sign in to your DNS host and open the DNS records for yourbusiness.com.
- Add a new record and choose CNAME as the type.
- For the name (some hosts call it Host), enter
selector1._domainkey. - For the value (sometimes called Points to or Target), paste the selector1 value from Microsoft.
- Set the TTL to 1 hour (3600 seconds) if your host lets you choose. Microsoft recommends at least that.
- Save, then repeat with the name
selector2._domainkeyand the selector2 value.
Microsoft says it can take a few minutes, or longer, to detect new records.
How do I turn on DKIM signing?
Go back to the tab with the domain details panel you left open.
- Select the Sign messages for this domain with DKIM signatures toggle.
- A dialog says the change may take several minutes to sync. Select OK.
- Check that the status now reads Signing DKIM signatures for this domain.
If the toggle won't stay on, Microsoft hasn't found your records yet. Check them for typos, wait an hour, and try again. If you send email from more than one domain or subdomain in Microsoft 365, each one needs its own pair of records and its own switch.
Once signing works, Microsoft recommends changing the keys from time to time, for the same reasons you'd change a password. Select Rotate DKIM keys at the bottom of the domain details panel. The new key starts signing mail after four days (96 hours), and you can't start another rotation until then. Because your CNAME records point to Microsoft, you don't need to change anything in DNS.
See which email records your domain publishes
Our free checkup looks for DKIM at common selector names, including selector1 and selector2, along with SPF, DMARC and your website basics.
- Free check
- No signup
- No changes to your website
How do I check DKIM is working?
Give it a few minutes after you turn signing on, then send a test message.
- From your Microsoft 365 mailbox, email a personal address at another provider, such as Gmail or Outlook.com. Don't test with an address in your own domain: Microsoft leaves the signature off mail between addresses in the same organization. Microsoft also advises against testing with AOL.
- Open the full message headers. In Outlook, Microsoft calls these internet message headers. Microsoft's Message Header Analyzer (mha.azurewebsites.net) can make them easier to read.
- Find the
DKIM-Signatureline. It should included=yourbusiness.comands=selector1ors=selector2. - Find the
Authentication-Resultsline. It should includedkim=pass.
In the signature line, d= is the domain that signed the message and s= is the selector, which tells the receiver which DNS record holds the public key. If there's no DKIM-Signature line at all, or d= shows a domain other than yourbusiness.com, go back and check that the toggle is on.
You can also look up the records yourself. On a Mac, open Terminal and run dig CNAME selector1._domainkey.yourbusiness.com +short. On Windows, nslookup -type=CNAME selector1._domainkey.yourbusiness.com does the same job. Either way, the answer should match the value you copied from Microsoft.
Why isn't my DKIM working?
Most problems trace back to a short list of mistakes in Microsoft's troubleshooting guide:
- If the status stays at
CnameMissing, check that the name doesn't include your domain twice and that the record is a CNAME, not a TXT record. Microsoft 365 doesn't support TXT records for DKIM. - If signing worked but key rotation fails later, the selector2 record is probably missing.
- If receivers occasionally report
dkim=temperror, raise the TTL on both records to at least 3600 seconds. - If the value in DNS doesn't match what Microsoft expects, copy it again from the portal instead of building it by hand. Dots, dashes and the assigned letter are easy to get wrong.
- If DKIM passes but DMARC still fails, the signing domain doesn't match your From address. This often happens with a separate newsletter or billing service, which needs DKIM set up inside that service.
DNS changes can take up to 48 hours to reach everywhere. If the status is still CnameMissing after that, compare your records against the portal's values one character at a time.
What should you do next?
With DKIM signing your mail, you're ready to use DMARC properly:
- Check your DMARC record with our free DMARC checker, and add one at
p=noneif it's missing. - Read how to read DMARC reports so you know when it's safe to tighten the policy.
- Work through the rest of the Microsoft 365 security checklist, from MFA to forwarding rules.
- If other services send email as your domain and your SPF record is getting long, see SPF too many DNS lookups.
Common questions
Is DKIM turned on by default in Microsoft 365?
Only for your onmicrosoft.com address. Microsoft says no DKIM signing happens for outbound mail from a custom domain like yourbusiness.com until you publish the two CNAME records and turn signing on in the Defender portal.
Why does Microsoft 365 use CNAME records for DKIM instead of a TXT record?
The CNAME records point to public keys that Microsoft hosts, so Microsoft can manage and rotate your keys without you editing DNS again. Microsoft says a TXT record with the key in it isn't supported for Microsoft 365, and it leaves the status stuck at CnameMissing.
Do I need both selector1 and selector2?
Yes. Only one selector signs mail at a time, and the other takes over the next time your keys rotate. If the selector2 record is missing, Microsoft says signing may work at first but key rotation fails later.
Why does my domain still show CnameMissing?
Microsoft hasn't found matching records yet. The usual causes are a name with your domain typed twice, a TXT record instead of a CNAME, a value copied with a typo, or Cloudflare's proxy being on. DNS changes can take up to 48 hours to appear everywhere, so check the records, then give it time.
Should I rotate my DKIM keys?
Microsoft recommends rotating DKIM keys from time to time, for the same reason you'd change a password. In the domain's details in the Defender portal, select Rotate DKIM keys. The new key starts signing mail after four days (96 hours).
Sources
- How to use DKIM for email in your custom domain (Microsoft Learn)
- Set up DMARC to validate email in Microsoft 365 (Microsoft Learn)
- RFC 6376: DomainKeys Identified Mail (DKIM) Signatures (IETF / RFC Editor)
- RFC 9989: Domain-Based Message Authentication, Reporting, and Conformance (DMARC) (IETF / RFC Editor)
Related guides and tools
Keep building a safer business
Security is an ongoing process, but it doesn't have to be complicated. Run a free scan, fix what matters most, and check back for more guides.