Office Support / Office 365 Admin / Domains

Create DNS records for Office 365 using Windows-based DNS

If you host your own DNS records using Windows-based DNS, follow the steps in this article to set up your records for email, Lync, and so on.

To get started, you need to find the DNS records for your domain in Windows-based DNS so you can update them. Also, if you're planning to synchronize your on-premises Active Directory with Office 365, make sure you don't need to first update your user principal name (UPN).

These are the main records to add. (Need more help? Get support.)

If you haven't yet verified your domain, you'll also need to add a record to do that:

If you have a SharePoint Online Public Website, you can set it up to use your custom domain.

Note    Typically it takes about 15 minutes for DNS changes to take effect. However, it can take up to 72 hours for a changed record to propagate through the DNS system. If you’re having trouble adding DNS records, see Troubleshoot issues after changing your domain name or DNS records.

Find your DNS records in Windows-based DNS

Task

Go to the page that has the DNS records for your domain.

  1. If you're working in Windows Server 2008, go to Start > Run.

    If you're working in Windows Server 2012, press the Windows key and r.

  2. Type dnsmgmnt.msc, and then choose OK.

  3. In DNS Manager, expand <DNS server name> > Forward Lookup Zones.

  4. Choose your domain.

You’re now ready to create the DNS records.

Add MX record

Add an MX record so email for your domain will come to Office 365.

Task

The MX record you'll add includes a value (the Points to address value) that looks something like this: <MX token>.mail.protection.outlook.com, where <MX token> is a value like MSxxxxxxx.

  1. From the MX row in the Exchange Online section of the Add DNS records page in Office 365, copy the value listed under Points to address.

    You'll use this value in the record you're creating in this task.

  2. On the DNS Manager page for the domain, go to Action > Mail Exchanger (MX).

    To find this page for the domain, see Find your DNS records in Windows-based DNS.

  3. In the New Resource Record dialog box, make sure that the fields are set to precisely the following values:

    • Host Name: @

    • Address: Paste the Points to address value that you just copied from Office 365 here.

    • Pref: 0

      For more information about priority, see What is MX priority?

  4. Choose Save Changes.

Remove any obsolete MX records.

If you have any old MX records for this domain that route email somewhere else:

  1. Select the check box next to each old record, and then choose Delete.

  2. Choose OK.

Back to top

Add CNAME records

Add the CNAME records that are required for Office 365. If additional CNAME records are listed in Office 365, add those following the same general steps shown here. Add the two Mobile Device Manager (MDM) records only if you use MDM.

Task

Add the email (Exchange) Autodiscover CNAME record.

  1. On the DNS Manager page for the domain, go to Action > CNAME (CNAME).

    To find this page for your domain, see Find your DNS records in Windows-based DNS.

  2. In the New Resource Record dialog box, make sure that the fields are set to precisely the following values:

    • Host Name: autodiscover

    • Type: CNAME

    • Address: autodiscover.outlook.com

  3. Choose OK.

Add the SIP CNAME record.

  1. On the DNS Manager page for the domain, go to Action > CNAME (CNAME).

    To find this page for your domain, see Find your DNS records in Windows-based DNS.

  2. In the New Resource Record dialog box, make sure that the fields are set to precisely the following values:

    • Host Name: sip

    • Type: CNAME

    • Address: sipdir.online.lync.com

  3. Choose OK.

Add the Lync Autodiscover CNAME record.

  1. On the DNS Manager page for the domain, go to Action > CNAME (CNAME).

    To find this page for your domain, see Find your DNS records in Windows-based DNS.

  2. In the New Resource Record dialog box, make sure that the fields are set to precisely the following values:

    • Host Name: lyncdiscover

    • Type: CNAME

    • Address: webdir.online.lync.com

  3. Choose OK.

Add the additional CNAME record that is required for Office 365.

  1. On the DNS Manager page for the domain, go to Action > CNAME (CNAME).

    To find this page for your domain, see Find your DNS records in Windows-based DNS.

  2. In the New Resource Record dialog box, make sure that the fields are set to precisely the following values:

    • Host Name: msoid

    • Type: CNAME

    • Address: clientconfig.microsoftonline-p.net

  3. Choose OK.

Add two CNAME records for Multiple Device Manager (MDM)

Important   If you have Multiple Device Manager (MDM), then you must also create the following two CNAME records.

Task

Add the MDM Enterpriseregistration CNAME record.

  1. On the DNS Manager page for the domain, go to Action > CNAME (CNAME).

    To find this page for your domain, see Find your DNS records in Windows-based DNS.

  2. In the New Resource Record dialog box, make sure that the fields are set to precisely the following values:

    • Host Name: enterpriseregistration

    • Type: CNAME

    • Address: enterpriseregistration.windows.net

  3. Choose OK.

Add the MDM Enterpriseenrollment CNAME record.

  1. On the DNS Manager page for the domain, go to Action > CNAME (CNAME).

    To find this page for your domain, see Find your DNS records in Windows-based DNS.

  2. In the New Resource Record dialog box, make sure that the fields are set to precisely the following values:

    • Host Name: enterpriseenrollment

    • Type: CNAME

    • Address: enterpriseenrollment.manage.microsoft.com

  3. Choose OK.

Back to top

Add TXT record for SPF

Add the SPF TXT record for your domain to help prevent email spam.

Task

What you’ll see

You might already have other strings in the TXT value for this record (such as strings for marketing email), which is fine. Leave those strings in place and add this one, placing double-quotes around each string to separate them.

  1. On the DNS Manager page for your domain, go to Action > Text (TXT).

    To find this page for your domain, see Find your DNS records in Windows-based DNS.

  2. In the New Resource Record dialog box, make sure that the fields are set to precisely the following values.

    Important   In some versions of Windows DNS Manager, the domain may have been set up so that when you create a txt record, the home name defaults to the parent domain. In this situation, when adding a TXT record, set the host name to blank (no value) instead of setting it to @ or the domain name. This KB article on setting up SPF records has more information.

    • Host type: @

    • Record Type: TXT

    • Address: v=spf1 include:spf.protection.outlook.com -all

      We recommend copying and pasting this entry, so that all of the spacing stays correct.

  3. Choose OK.

Back to top

Add SRV records

Add the two SRV records that are required for Office 365.

Task

Add the SIP SRV record for Lync web conferencing.

  1. On the DNS Manager page for your domain, go to Action > Other New Records.

    To find this page for your domain, see Find your DNS records in Windows-based DNS.

  2. In the Resource Record Type window, choose Service Location (SRV), and then click Create Record.

  3. In the New Resource Record dialog box, make sure that the fields are set to precisely the following values:

    • Service: _sip

    • Protocol: _tls

    • Priority: 100

    • Weight: 1

    • Port: 443

    • Target (Hostname): sipdir.online.lync.com

  4. Choose OK.

Add the SIP SRV record for Lync federation.

  1. On the DNS Manager page for your domain, go to Action > Other New Records.

    To find this page for your domain, see Find your DNS records in Windows-based DNS.

  2. In the Resource Record Type window, choose Service Location (SRV), and then click Create Record.

  3. In the New Resource Record dialog box, make sure that the fields are set to precisely the following values:

    • Service: _sipfederationtls

    • Protocol: _tcp

    • Priority: 100

    • Weight: 1

    • Port: 5061

    • Target (Hostname): sipfed.online.lync.com

  4. Choose OK.

Back to top

Add a record to verify that you own the domain, if you haven’t already

Before you add the DNS records to set up your Office 365 services, Office 365 has to confirm that you own the domain you’re adding. To do this, you add a record, following the steps below.

Note    This record is used only to verify that you own your domain; it doesn’t affect anything else.

Task

Gather information from Office 365.

  1. Sign in to Office 365 with your work or school account.

  2. Go to the Manage domains page.

  3. On the Manage domains page, in the Action column for the domain that you are verifying, choose Start setup.

    Note   If you haven’t yet added a domain, see Verify your domain in Office 365.

  4. On the Add a domain to Office 365 page, choose Start step 1.

  5. On the Confirm that you own your_domain page, in the See instructions for performing this step with drop-down list, choose General instructions.

  6. From the table, copy the Destination or Points to Address value. You’ll need it for the next step.

    We recommend copying and pasting this value, so that all of the spacing stays correct.

Add a TXT record.

  1. On the DNS Manager page for your domain, go to Action > Text (TXT).

    To find this page for your domain, see Find your DNS records in Windows-based DNS.

  2. In the New Resource Record dialog box, choose Edit.

  3. In the Custom Host Names area of the New Resource Record dialog box, make sure that the fields are set to precisely the following values.

    Important   In some versions of Windows DNS Manager, the domain may have been set up so that when you create a txt record, the home name defaults to the parent domain. In this situation, when adding a TXT record, set the host name to blank (no value) instead of setting it to @ or the domain name. This KB article on setting up SPF records has more information.

    • Host Name: @

    • Type: TXT

    • Address: Paste the Destination or Points to Address value that you just copied from Office 365 here.

  4. Choose OK, and then choose Done.

Verify your domain in Office 365.

Important   Wait about 15 minutes before you do this, so the record you just created can update across the Internet.

Go back to Office 365 and follow the steps below to request a verification check. The check looks for the TXT record you added in the previous step. When it finds the correct TXT record, the domain is verified.

  1. Go to the Manage domains page.

  2. On the Manage domains page, in the Action column for the domain you are verifying, choose Start setup.

  3. On the Confirm that you own your_domain page, choose done, verify now and then, in the confirmation dialog box, choose Finish.

Back to top

Non-routable email address used as a UPN in your on-prem Active Directory

If you're planning to synchronize your on-premises Active Directory with Office 365, you’ll want to make sure that the Active Directory user principal name (UPN) suffix is a valid domain suffix, and not an unsupported domain suffix such as @contoso.local. If you need to change your UPN suffix, we’ve got instructions to help you with that.

Back to top

Still need help?

Get help from the Office 365 community forums Admins: Sign in and create a service request Admins: Call Support

Back to top

Applies To: Office 365 Admin, Office 365 Small Business Admin



Was this information helpful?

Yes No

How can we improve it?

255 characters remaining

To protect your privacy, please do not include contact information in your feedback. Review our privacy policy.

Thank you for your feedback!

Support resources

Change language