DNS records for Microsoft 365 email

microsoft 365, exchange online, mx, spf, dkim, autodiscover, dns · 0 found this helpful

Use this when your mailboxes are at Microsoft 365 and your domain's DNS is managed at Barbrick. The Microsoft 365 admin centre shows the exact values for your tenant. Use the table as a guide to what to expect, and copy the real values from Microsoft.

Before you start

Records for example.ca

Purpose Type Name Value TTL Priority
Verification TXT @ MS=ms12345678 3600
Mail delivery MX @ example-ca.mail.protection.outlook.com 3600 0
Autodiscover CNAME autodiscover autodiscover.outlook.com 3600
SPF TXT @ v=spf1 include:spf.protection.outlook.com -all 3600
DKIM 1 CNAME selector1._domainkey selector1-example-ca._domainkey.northshorebakery.onmicrosoft.com 3600
DKIM 2 CNAME selector2._domainkey selector2-example-ca._domainkey.northshorebakery.onmicrosoft.com 3600
DMARC TXT _dmarc v=DMARC1; p=none; rua=mailto:[email protected] 3600

The MX target is your domain with dots changed to hyphens, followed by .mail.protection.outlook.com. For example.ca it is example-ca.mail.protection.outlook.com. Copy the exact value from the admin centre.

In the DNS page, enter names relative to your domain, such as autodiscover and selector1._domainkey.

Optional records

Microsoft Teams no longer needs the lyncdiscover, sip, and SIP SRV records, and Skype for Business Online has been retired. Add them only if the admin centre lists them for your tenant. The two enterprise records are for Intune device management.

Type Name Value Priority Weight Port
CNAME lyncdiscover webdir.online.lync.com
CNAME sip sipdir.online.lync.com
SRV _sip._tls sipdir.online.lync.com 100 1 443
SRV _sipfederationtls._tcp sipfed.online.lync.com 100 1 5061
CNAME enterpriseregistration enterpriseregistration.windows.net
CNAME enterpriseenrollment enterpriseenrollment.manage.microsoft.com

See SRV records.

Quickest way

The DNS page has a template that does steps 3 to 5 and 7 for you.

  1. Open Account → Hosting → your site → DNS.
  2. Under Moving email elsewhere?, find Microsoft 365 and click Apply, then Apply template.
  3. We replace your MX and SPF records, and add the Autodiscover CNAME, and set Mail routing to Remote. Mailboxes here stop receiving new mail.
  4. Add the verification TXT record from Microsoft and turn on DKIM, as in steps 1, 2 and 6 below.

Steps

  1. In the Microsoft 365 admin centre, choose Settings → Domains → Add domain and enter example.ca.
  2. Add the TXT verification record in your Barbrick DNS page. Return to Microsoft and select Verify.
  3. Choose to add DNS records yourself. Create the MX, CNAME, and TXT records above.
  4. Delete the old MX record that points to example.ca or mail.example.ca. Leaving it sends some mail to Barbrick instead.
  5. Replace the old SPF record. A domain may have only one. Merge any other senders into it. See SPF.
  6. In the admin centre, turn on DKIM signing for the domain after the two DKIM CNAME records resolve.
  7. Open Account → Hosting → your site → Email, open the More tab, find Mail routing, select example.ca, and choose Remote. See MX records.

To save steps, the DNS page also has an Apply template button for Microsoft 365. It sets the MX, SPF, and autodiscover records and switches mail routing to Remote in one step. It replaces your existing root MX and SPF records, so add Barbrick's SPF entries back afterwards if your website sends mail (see below).

Check

dig MX example.ca +short
dig CNAME autodiscover.example.ca +short
dig TXT example.ca +short
0 example-ca.mail.protection.outlook.com.
autodiscover.outlook.com.
"v=spf1 include:spf.protection.outlook.com -all"
"MS=ms12345678"

If you also send from your website

If a contact form or WordPress sends email from @example.ca through Barbrick's server, add Barbrick's entries to SPF, or the mail fails. Copy the +a, +mx, +ip4:, and include: entries from the existing SPF record in Account → Hosting → your site → DNS, before you replace it. See Set up SPF, DKIM, and DMARC.

example.ca.  3600  IN  TXT  "v=spf1 include:spf.protection.outlook.com +a +mx +ip4:203.0.113.25 include:<Barbrick relay> ~all"

If something goes wrong

  • Email to Barbrick mailboxes stops. Expected. Mail now goes to Microsoft. Move old messages. See Import email from your old provider.
  • Admin centre cannot find the MX. DNS has not refreshed. Wait up to an hour and check your DNS records for typos.
  • Outlook cannot find the account. Check the Autodiscover CNAME.

Was this helpful?

Still stuck? Ask us and we'll walk you through it.