Change nameservers to set up Microsoft 365 with any domain registrar
Check the Domains FAQ if you don't find what you're looking for.
Follow these instructions to add and set up your domain in Microsoft 365 so your services like email and Teams will use your own domain name. To do this, you'll verify your domain, and then change your domain's nameservers to Microsoft 365 so the correct DNS records can be set up for you. Follow these steps if the following statements describe your situation:
You have your own domain and want to set it up to work with Microsoft 365.
You want Microsoft 365 to manage your DNS records for you. (If you prefer, you can manage your own DNS records.)
Add a TXT or MX record for verification
Note
You will create only one or the other of these records. TXT is the preferred record type, but some DNS hosting providers don't support it, in which case you can create an MX record instead.
Before you use your domain with Microsoft 365, we have to make sure that you own it. Your ability to log in to your account at your domain registrar and create the DNS record proves to Microsoft 365 that you own the domain.
Note
This record is used only to verify that you own your domain; it doesn't affect anything else. You can delete it later, if you like.
Find the area on your DNS hosting provider's website where you can create a new record
Sign in to your DNS hosting provider's website.
Choose your domain.
Find the page where you can edit DNS records for your domain.
Create the record
Depending on whether you are creating a TXT record or an MX record, do one of the following:
If you create a TXT record, use these values:
Record type | Alias or host name | Value | TTL |
---|---|---|---|
TXT | Do one of the following: Type @ or leave the field empty or type your domain name. Note: Different DNS hosts have different requirements for this field. |
MS=ms XXXXXXXX Note: This is an example. Use your specific Destination or Points to Address value here, from the table in Microsoft 365. How do I find this? |
Set this value to 1 hour or to the equivalent in minutes ( 60 ), seconds ( 3600 ), etc. |
If you create an MX record, use these values:
Record type | Alias or host name | Value | Priority | TTL |
---|---|---|---|---|
MX | Type either @ or your domain name. | MS=ms XXXXXXXX Note: This is an example. Use your specific Destination or Points to Address value here, from the table in Microsoft 365. How do I find this? | For Priority, to avoid conflicts with the MX record used for mail flow, use a lower priority than the priority for any existing MX records. For more information about priority, see What is MX priority? | Set this value to 1 hour or to the equivalent in minutes ( 60 ), seconds ( 3600 ), etc. |
Save the record
Now that you've added the record at your domain registrar's site, you'll go back to Microsoft 365 and request Microsoft 365 to look for the record.
When Microsoft 365 finds the correct TXT record, your domain is verified.
In the admin center, go to the Settings > Domains page.
On the Domains page, select the domain that you are verifying.
On the Setup page, select Start setup.
On the Verify domain page, select Verify.
Note
Typically it takes about 15 minutes for DNS changes to take effect. However, it can occasionally take longer for a change you've made to update across the Internet's DNS system. If you're having trouble with mail flow or other issues after adding DNS records, see Troubleshoot issues after changing your domain name or DNS records.
Change your domain's nameserver (NS) records
When you get to the last step of the domains setup wizard in Microsoft 365, you have one task remaining. To set up your domain with Microsoft 365 services, like email, you change your domain's nameserver (or NS) records at your domain registrar to point to the Microsoft 365 primary and secondary nameservers. Then, because Microsoft 365 hosts your DNS, the required DNS records for your services are set up automatically for you. You can update the nameserver records yourself by following the steps your domain registrar may provide in the help content at their website. If you're not familiar with DNS, contact support at the domain registrar.
To change your domain's nameservers at your domain registrar's website yourself, follow these steps:
Find the area on the domain registrar's website where you can change the nameservers for your domain or an area where you can use custom nameservers.
Create nameserver records, or edit the existing nameserver records to match the following values:
- First nameserver: ns1.bdm.microsoftonline.com
- Second nameserver: ns2.bdm.microsoftonline.com
- Third nameserver: ns3.bdm.microsoftonline.com
- Fourth nameserver: ns4.bdm.microsoftonline.com
Tip
It's best to add all four records, but if your registrar only supports two, add ns1.bdm.microsoftonline.com and ns2.bdm.microsoftonline.com.
Save your changes.
Caution
When you change your domain's NS records to point to the Microsoft 365 nameservers, all the services that are currently associated with your domain are affected. If you skipped any steps of the wizard, such as adding email addresses, or if you're using your domain for blogs, shopping carts, or other services, there are additional steps that are required. Otherwise this change could result in service downtime, such as lack of email access or your current website being inaccessible.
Find the area on the domain registrar's website where you can edit the nameservers for your domain.
Create two nameserver records, or edit the existing nameserver records to match the following values:
- First nameserver: ns1.dns.partner.microsoftonline.cn
- Second nameserver: ns2.dns.partner.microsoftonline.cn
Tip
You should use at least two nameserver records. If there are any other nameservers listed, you can either delete them, or change them to ns3.dns.partner.microsoftonline.cn and ns4.dns.partner.microsoftonline.cn.
Save your changes.
Caution
When you change your domain's NS records to point to the Microsoft 365 operated by 21Vianet nameservers, all the services that are currently associated with your domain are affected. If you skipped any steps of the wizard, such as adding email addresses, or if you're using your domain for blogs, shopping carts, or other services, there are additional steps that are required. Otherwise this change could result in service downtime, such as lack of email access or your current website being inaccessible.
For example, here are some additional steps that might be required for email and website hosting:
Move all email addresses that use your domain to Microsoft 365 before you change your NS records.
Want to add a domain that's currently used with a website address, like
https://www.fourthcoffee.com
? You can take below steps while you add the domain to keep its website hosted where the site is hosted now so people can still get to the website after you change the domain's NS records to point to Microsoft 365.
In the admin center, go to the Settings > Domains page.
On the Domains page, select a domain.
On the domain details page, select the DNS records tab.
Select Add record.
In the Add a custom DNS record pane, from the Type dropdown list, select A (Address).
In the Host name or Alias box, type @.
In the IP Address box, type the static IP address for the website where it's currently hosted. For example, 172.16.140.1.
Important
This must be a static IP address for the website, not a dynamic IP address. To make sure you can get a static IP address for your public website, check with the site that hosts your website.
If you want to change the TTL setting for the record, select a new length of time from the TTL dropdown list. Otherwise, continue to step 9.
Select Save.
In addition, you can create a CNAME record to help customers find your website.
- Select Add record.
- In the Add a custom DNS record pane, from the Type dropdown list, select CNAME (Alias).
- In the Host name or Alias box, type www.
- In the Points to address box, type the fully qualified domain name (FQDN) for your website. For example, contoso.com.
- If you want to change the TTL setting for the record, select a new length of time from the TTL dropdown list. Otherwise, continue to step 6.
- Select Save.
After the nameserver records are updated to point to Microsoft, your domain setup is complete. Email is routed to Microsoft, and traffic to your website address continues to go to your current website host.`
Note
Your nameserver record updates may take up to several hours to update across the Internet's DNS system. Then your Microsoft email and other services will be all set to work with your domain.
Related content
Add DNS records to connect your domain (article)
Find and fix issues after adding your domain or DNS records (article)
Manage domains (link page)