DKIM for Microsoft 365

Microsoft 365 needs two CNAME records on your domain, then one switch in the Defender portal. Until you do this, it signs your mail with your onmicrosoft.com domain, and that signature doesn't count for DMARC.

selector1._domainkey   CNAME   (value from the Defender portal)
selector2._domainkey   CNAME   (value from the Defender portal)

Step by step

  1. Open the Defender portal at security.microsoft.com and go to Email & collaboration, Policies & rules, Threat policies, Email authentication settings, then the DKIM tab.
  2. Click your domain. The panel that opens shows the two CNAME values under Publish CNAMEs. Copy them exactly.
  3. At your DNS provider, add two CNAME records: host selector1._domainkey and host selector2._domainkey, each pointing to its value.
  4. Wait a few minutes (sometimes longer), go back to the same panel, and turn on Sign messages for this domain with DKIM signatures. The status should change to "Signing DKIM signatures for this domain".

What the values look like

Microsoft changed the format in May 2025. Domains added since then get values like this:

selector1-example-com._domainkey.yourtenant.n-v1.dkim.mail.microsoft

Domains added earlier keep the old format:

selector1-example-com._domainkey.yourtenant.onmicrosoft.com

The letter before -v1 is assigned by Microsoft and can't be guessed, so always copy the values from the portal. In Exchange Online PowerShell, Get-DkimSigningConfig -Identity example.com | Format-List Selector1CNAME,Selector2CNAME shows the same values.

The mistakes I see most

1024 or 2048 bits?

Gmail accepts 1024-bit keys and recommends 2048. Microsoft's PowerShell setup defaults to 1024. To move to 2048, run Rotate-DkimSigningConfig -Identity example.com -KeySize 2048. The 2048-bit key goes on the selector Microsoft switches to at this rotation.

Check your DKIM

I'll look up the Microsoft selectors and tell you whether DKIM is switched on for your own domain.

Related