Office 365 DKIM CNAME records explained: selector1, selector2 and CnameMissing

What each part of the two records means, why they're CNAMEs, and how to fix CnameMissing.

Most email services give you a DKIM key to paste into a TXT record. Microsoft 365 (still widely called Office 365) asks for something different: two CNAME records, named selector1._domainkey and selector2._domainkey, pointing at long Microsoft addresses. Until both are right, the Defender portal shows CnameMissing and won't let you turn DKIM signing on.

This guide explains what each part of those records means, why Microsoft uses CNAMEs, how the two selectors work during key rotation, and how to fix the errors that stop signing from turning on.

Check your two records now. Rigcheck looks up selector1 and selector2 and spots a doubled name, a TXT record, a proxied record or a value copied from the wrong domain.

The two records

For a custom domain added to Microsoft 365 since May 2025, the records look like this, with your own domain and tenant name in the value:

Hostselector1._domainkey
TypeCNAME
Valueselector1-yourdomain-com._domainkey.yourtenant.n-v1.dkim.mail.microsoft
Hostselector2._domainkey
TypeCNAME
Valueselector2-yourdomain-com._domainkey.yourtenant.n-v1.dkim.mail.microsoft

The host names are the same for every Microsoft 365 organization. The values are built from your own details, piece by piece:

Part of the valueWhat it is
selector1-The selector the record belongs to: selector1 in the first record, selector2 in the second.
yourdomain-comYour domain with every dot turned into a dash. marketing.yourdomain.com becomes marketing-yourdomain-com.
._domainkey.The fixed label every DKIM key lives under.
yourtenantThe first part of your onmicrosoft.com address. If you signed up as yourtenant.onmicrosoft.com, it's yourtenant.
nA single character Microsoft assigns (for example n or r). You can't choose it, and two domains in the same tenant can get different ones.
-v1.dkim.mail.microsoftThe format version and Microsoft's DKIM zone, the same for everyone.

Microsoft's own documentation says its example values are for illustration only, and the same goes for these: copy your real values from the Defender portal rather than building them by hand. The character Microsoft assigns can't be worked out from anything else.

The older format

Domains that had DKIM set up before May 2025 keep an older value that ends in your onmicrosoft.com address:

Hostselector1._domainkey
TypeCNAME
Valueselector1-yourdomain-com._domainkey.yourtenant.onmicrosoft.com
Hostselector2._domainkey
TypeCNAME
Valueselector2-yourdomain-com._domainkey.yourtenant.onmicrosoft.com

Both formats work. Don't switch an existing domain to the new one on your own: Microsoft notes that the two formats can't be mixed for the same selector, so use whatever the portal shows for your domain.

Subdomains and extra domains

Every domain or subdomain you send from needs its own pair of records. A tenant with two custom domains needs four CNAME records, two in each domain's DNS. For a subdomain such as marketing.yourdomain.com, the records go at selector1._domainkey.marketing and selector2._domainkey.marketing in the yourdomain.com zone, and the value uses marketing-yourdomain-com.

Why CNAME and not TXT

A DKIM public key normally sits in a TXT record at <selector>._domainkey.yourdomain.com, and receivers look it up there to check each message's signature. Microsoft keeps the keys for your domain itself and publishes them under its own DNS names. Your CNAME records simply point receivers there.

That means Microsoft can create and replace your keys without you ever editing DNS again. Microsoft states plainly that a DKIM TXT record you publish yourself isn't supported for Microsoft 365, because you'd then have to manage the keys and rotation yourself. If you've added one, it also stops the CNAME from working: a DNS name can't hold a CNAME and another record at the same time.

What selector2 is for: key rotation

Microsoft creates two key pairs for your domain but signs with only one at a time. The other selector waits, and comes into use the next time the keys are rotated. That's why Microsoft asks for both records even though only one is active.

  • Rotating keys. In the Defender portal, open your domain on the DKIM tab and select Rotate DKIM keys. The switch isn't immediate: the new key starts signing after four days (96 hours), and the current key keeps signing until then. You can't start another rotation while one is in progress.
  • When rotation is available. Only when signing is Enabled and the status is Valid or CnameMissing. During a rotation the button is greyed out.
  • Moving to a 2048-bit key. New keys are 1024-bit by default. In Exchange Online PowerShell, Rotate-DkimSigningConfig -Identity yourdomain.com -KeySize 2048 rotates to a 2048-bit key. The new size applies to the selector that becomes active, so the other selector gets it on the following rotation.
  • Which selector is in use. Open a message you sent in the recipient's mail program, view the headers, and find the DKIM-Signature line. The s= value names the selector that signed it.

Where to find your exact values

  1. Go to the Microsoft Defender portal at security.microsoft.com and open Email & collaboration → Policies & rules → Threat policies → Email authentication settings, then the DKIM tab.
  2. Click your domain's row (not the toggle) to open its details.
  3. If it shows Create DKIM keys, click it.
  4. Copy both values under Publish CNAMEs.

In Exchange Online PowerShell, this shows the same values:

Get-DkimSigningConfig -Identity yourdomain.com | Format-List Name,Enabled,Status,Selector1CNAME,Selector2CNAME

If your domain isn't in the list at all, check that it's added and verified in the Microsoft 365 admin center under Settings → Domains. The Microsoft 365 SPF, DKIM and DMARC setup guide walks through the full setup from the start, and how to set up DKIM in Office 365 covers the DKIM steps in detail, PowerShell included.

Fixing CnameMissing

The DKIM tab shows one of a few statuses for each domain:

StatusWhat it means
NoDKIMKeysMicrosoft hasn't created keys for the domain yet. Click Create DKIM keys.
CnameMissingKeys exist, but Microsoft can't find both CNAME records in your DNS with the right values.
ValidThe records are found. With the toggle on, Microsoft is signing your mail with your domain.

CnameMissing straight after you create the keys is normal: it just means you haven't added the records yet, or DNS hasn't caught up. Microsoft says detection takes a few minutes or possibly longer, and in its troubleshooting it allows up to 48 hours depending on your DNS host and TTL settings. If it's still showing after that, one of these is almost always the cause.

The domain is doubled in the name

Most DNS hosts add your domain to the name automatically. Typing selector1._domainkey.yourdomain.com then creates selector1._domainkey.yourdomain.com.yourdomain.com. Enter only:

Hostselector1._domainkey
TypeCNAME
Valueyour Selector1CNAME value from the portal
Hostselector2._domainkey
TypeCNAME
Valueyour Selector2CNAME value from the portal

A trailing dot problem

Some DNS hosts need a dot at the end of the value to mark it as a complete name. Others add one for you, and typing it yourself breaks the record. If the record looks right but isn't found, check your DNS host's own instructions for CNAME values.

The record is proxied (Cloudflare)

If your DNS is on Cloudflare, set both records to DNS only (grey cloud). A proxied record answers with Cloudflare's addresses instead of the CNAME, so Microsoft and receivers never see where it points.

The records are in the wrong place

Your domain's DNS is managed wherever its nameservers point, which isn't always where you bought the domain. Records added at the registrar while your DNS is hosted at Cloudflare or your web host never go live. The same applies to a subdomain with its own DNS zone.

Check what DNS really shows

From a computer, ask public DNS directly. On macOS or Linux:

dig CNAME selector1._domainkey.yourdomain.com +short
dig CNAME selector2._domainkey.yourdomain.com +short

On Windows:

nslookup -type=CNAME selector1._domainkey.yourdomain.com
nslookup -type=CNAME selector2._domainkey.yourdomain.com

Each should print the Microsoft value from the portal. Nothing at all means the record is missing, misnamed or not live yet. The Office 365 DKIM checker runs these lookups for you and names the problem.

The DKIM signing toggle won't turn on

Turning on signing is a separate step from publishing the records. In the domain's details on the DKIM tab, switch Sign messages for this domain with DKIM signatures to on. What happens next tells you what's wrong:

  • A "Client error" dialog full of text appears, and the status becomes CnameMissing. Microsoft didn't find the records yet. The dialog contains the values you need, but they're easier to copy from Publish CNAMEs in the domain's details. Add or fix the records, wait, then try the toggle again.
  • A dialog says it may take several minutes to synchronize. That's the normal response. Close it and check back: when it worked, the toggle stays on, the status reads Signing DKIM signatures for this domain, and Rotate DKIM keys becomes available.
  • The toggle flips straight back to Disabled. If your records check out, Microsoft lists this as a rare case where the records are found but keys can't be generated. Its advice is to contact Microsoft Support with the output of Get-DkimSigningConfig -Identity yourdomain.com.
  • The domain has no toggle or isn't listed. The domain isn't added and verified in Microsoft 365 yet, or keys were never created. In PowerShell, New-DkimSigningConfig -DomainName yourdomain.com -Enabled $false creates the keys, and Get-DkimSigningConfig then shows the values to publish.

The portal can be slow to update. In PowerShell, once the records are in place, this turns signing on directly, and if Microsoft still can't see the records the error includes the values it expects:

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

Afterwards, Get-DkimSigningConfig should show Enabled: True and Status: Valid.

Confirm your mail is signed

  1. Send a message from your Microsoft 365 mailbox to an address outside your organization, such as a personal Gmail account. Microsoft doesn't add a DKIM signature when sender and recipient are in the same domain, or in domains run by the same organization, so an internal test shows nothing.
  2. In Gmail, open the message, tap the three-dot menu and choose Show original. DKIM should say PASS.
  3. In the DKIM-Signature line, d= should be your domain, not onmicrosoft.com. If it shows onmicrosoft.com, signing isn't on for your domain yet.

Other problems

  • DKIM fails now and then, with dkim=temperror. Microsoft links this to a very low TTL on the DKIM records and recommends at least 3600 seconds (one hour).
  • DKIM passes but DMARC fails. The signing domain has to match the domain in the From address, subdomains included. DMARC setup for Microsoft 365 covers the rest of the rollout.
  • It works for one domain but not another. Each domain needs its own two records in its own DNS, and its own toggle switched on.

Check your Office 365 DKIM records. See whether selector1 and selector2 point to Microsoft, and get the exact fix if they don't.

Check my setup

Browse all guides