If your business email runs on Microsoft 365, there’s a good chance DKIM isn’t set up for your own domain. Microsoft signs mail from your yourcompany.onmicrosoft.com domain automatically, but not mail sent from your custom domain until you switch it on. Without it, DKIM can’t help your emails pass DMARC, which matters more every year as Gmail and Microsoft tighten their rules.
Here’s how to set it up, step by step, in about 15 minutes plus waiting for DNS.
Before you start
- You need a Microsoft 365 admin account with access to the Microsoft Defender portal.
- You need access to your domain’s DNS settings (your registrar or DNS host).
- Your domain must already be added and verified in Microsoft 365.
Step 1: open the DKIM settings
In the Microsoft Defender portal, go to Email & collaboration → Policies & rules → Threat policies → Email authentication settings, then open the DKIM tab. You’ll see a list of your domains with their DKIM status.
Step 2: get your two CNAME records
Select your domain. If DKIM has never been set up, switch the toggle to Enabled. Microsoft will show an error explaining that the CNAME records are missing. That’s expected. The domain’s details panel then shows two records under Publish CNAMEs, which look like this:
Host name: selector1._domainkey
Points to: selector1-yourdomain-co-uk._domainkey.yourcompany.n-v1.dkim.mail.microsoft
Host name: selector2._domainkey
Points to: selector2-yourdomain-co-uk._domainkey.yourcompany.n-v1.dkim.mail.microsoft
Copy the exact values from the portal rather than typing them yourself. Domains added before May 2025 use an older format ending in onmicrosoft.com, and the letter before -v1 varies between tenants.
Step 3: add both CNAMEs to your DNS
At your DNS host, create two CNAME records with those host names and values. You need both, even though only one is used at a time: Microsoft switches between them when it rotates keys.
A common mistake: some DNS panels add your domain to the host name automatically, so enter just selector1._domainkey rather than the full domain if your panel works that way.
Step 4: switch on signing
Once DNS has updated (minutes to a few hours), go back to the domain in the DKIM tab and turn on Sign messages for this domain with DKIM signatures. The status should change to Signing DKIM signatures for this domain. If it still says CnameMissing, give DNS a little longer and check the records for typos.
Step 5: move to a 2048-bit key
Microsoft has historically created 1024-bit keys by default. Google recommends 2048-bit keys, and they’re stronger. In the domain’s details, choose Rotate DKIM keys and pick 2048 bits if offered (or use PowerShell: Rotate-DkimSigningConfig -Identity yourdomain.co.uk -KeySize 2048). A rotation takes around four days to take effect, and you need to rotate twice to move both selectors to 2048.
Step 6: check it’s working
Send an email from your Microsoft 365 mailbox to a Gmail or Outlook.com address and view the full headers. You’re looking for:
DKIM-Signature: ... d=yourdomain.co.uk; s=selector1 ...
Authentication-Results: ... dkim=pass header.d=yourdomain.co.uk
If the signature shows d=yourcompany.onmicrosoft.com instead, signing isn’t on yet for your custom domain. Our guide to why DKIM fails covers the other common errors.
Don’t stop at Microsoft 365
DKIM in Microsoft 365 only covers mail sent from your Microsoft 365 mailboxes. Your newsletter platform, CRM, helpdesk and invoicing system each need their own DKIM set up for your domain. Your DMARC reports will show you which ones are still unsigned. And once everything aligns, you can move your DMARC policy to enforcement.
Need a hand with Microsoft 365?
Send a test email from Microsoft 365 to The Inbox Wizard Test to see whether SPF, DKIM and DMARC pass, or talk to us about setting up DKIM for Microsoft 365 and every other platform that sends as your domain.
