Many organizations today have on-premises Exchange 2016 or Exchange 2019 servers that have a hybrid connection to Microsoft 365, or, as it used to be called, Office 365. You would assume that everything should work right. Well, in the case where you have this kind of setup, it can cause some disruption in setting up Outlook client profiles when Outlook defaults to the Microsoft 365 version.
Are you wondering what I am talking about? Let me explain. When you launch your Outlook client, whether it is Office 2016 or 2019 or the Office 365 version of Outlook, you are prompted for your credentials, which is normal when you set up an account. And you should be prompted for your auto-discover information — accept it, and then your mailbox opens and sets up for the first time and all your mail downloads. Is Outlook connected without error? Let’s dive deeper, using my domain as an example, which is “thexchangelab.com.”
In DNS, I have my auto-discover record defined to point to my on-premises Exchange 2016 servers and all my URLs are defined to use mail.thexchangelab.com. Not complicated at all, right? Externally everything is resolvable and I can set up my mobile device with my Exchange 2016 account and all works fine.
Logging into Outlook on the Web (also known as OWA), I get the login page (shown below) and can log in fine without an error.
Outlook defaults to Microsoft 365 version: Wrong domain
The challenge (I would not say problem as it has a workaround) is that when you have entered your credentials as I mentioned above and Outlook opens, you will notice it shows your domain like [email protected] instead of [email protected]. Do you see what happened here? Your credentials were accepted, but it took you to your Office 365 mailbox and not your on-premises Exchange 2016 mailbox. You will also notice there was no auto-discover popup to accept and then tick the box to not remind you again.
What I have found is if a customer moves to a hosted Exchange 2016/2019 solution but does not have an Office 365 tenant, you do not experience the challenge above. Your account sets up with the correct mailbox on Exchange 2016, and you get the auto-discover record popup.
I have also seen this error when customers migrate from on-premises Exchange — it can be 2007 or 2010 — to a hosted platform on Exchange 2016 or 2019 using MigrationWiz. The workaround for both is the same.
So how do we solve this small issue?
The workaround that you can put in place to get the Outlook 2013/2016/2019 profile to set up with the correct mailbox is to add a host file entry to the local hosts file on an end-user’s machine.
To do this, you need to first launch Notepad from the Start Menu or the shortcut you have pinned to the Taskbar. You must do this with elevated permission, as you cannot edit files in a standard Notepad window that reside in the Windows directory.
Navigate to C:\Windows\System32\drivers\etc and open the “hosts” file, as shown below:
Click the open button to open up the hosts file. You should have a window, as shown below:
This is a straightforward hosts file without modification. We now need to add the following entry to the hosts file:
- 127.0.0.1 outlook.office365.com
Your hosts file should now look like this:
When you start with a new Outlook profile, you should now be presented with options under “advanced” with the option to select Exchange. See an example of this below. (Versions of Office might differ.)
You can now enter your email and password, and then your account setup should go through and your Outlook client will show your on-premises mailbox.
Word of caution
One caveat: f you are an admin and look after customer Office 365 tenants and you make use of the portal a lot, you will not be able to use the Exchange Admin Center because you pointed it to your loopback adapter in the hosts file to set up your account. If you forget to remove the entry and if you try to manage the Exchange Admin Center, then this is what you will be presented with:
Don’t panic and log a call with Microsoft to say you cannot manage your environment! Here’s what you do to fix this: Let’s go back to our Notepad, where we had the hosts file open and simply put a # hash in front of that entry we created and then save the file again.
Now go back to the web page and click the reload button and then you should see the Exchange Admin Center:
This is the classic Exchange Admin Center. If you are trying out the new one, it should also load. (See below.)
That is your workaround for when your Outlook defaults to the Microsoft 365 version. Please note it’s not a solution. This will enable you to get the accounts set up, and then you can use the Exchange Admin Center.