How to Prevent Outlook Connecting to Office 365 Account
Outlook and Windows is now set to connect to Office 365 instead of your on-premises or PIP hosted Exchange server due to Microsoft’s changes to the Autodiscover service. The Autodiscover service is the feature that tells your Outlook Client where your mailbox resides and automatically configures the settings. When you start your Email Client, it checks for a series of potential configurations. Currently the first place it will look for your Email address is at Windows 365. If your Microsoft 365 Email account is discoverable, Outlook will connect to it and assume this is your Email address. At this point it will stop the Autodiscovery process before discovering your real Email address. Therefore if you run a hybrid environment and have the same email address for Microsoft’s exchange online and your external Email server, Outlook will default to the Office 365 account.
Unfortunately in this scenario Outlook will not throw a meaningful error message, it will just continue prompting you for your credentials. As at this point it is trying to Authenticate you on your Windows 365 Account. For added complexity, if your credentials for your Windows 365 Account and your private Email service are the same, you may actually “successfully” setup your Email Client only to find you synchronise no Email, nor receive or send any new Email.
To resolve this issue, you can modify your registry settings to exclude Office 365 as an Autodiscover endpoint, by adding the excludeexplicito365endpoint key to your registry under the autodiscover container. This will force Outlook to skip the Office 365 check and connect directly to your own Email Servers. However, please be careful when modifying the Registry as any changes could potentially cause your computer to not work properly.
To prevent Outlook from automatically connecting to an Office 365 account, it is best practice to create a registry entry that excludes your Outlook from detecting Office 365.
Here are the steps:
- Open the Registry Editor by typing `regedit` in the Windows Search or open the run and type `regedit.exe`. If you encounter a prompt asking if you want to allow this device to make changes on your device, click “yes”.
- Navigate to this location in the Registry Editor: `HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Outlook\AutoDiscover.
- Create a DWORD (32-bit) value for `ExcludeExplicitO365Endpoint` and change the value to `1` to enable it.
- Restart your computer for the changes to take effect.
- Create a new Outlook Profile by going to the control panel. It should not see the Office 365 mailboxes anymore.
Alternatively, you can also add the registry through Command Prompt or PowerShell:
Command Prompt: `reg add HKEY_CURRENT_USER\Software\Microsoft\Office\x.0\Outlook\AutoDiscover /t REG_DWORD /v ExcludeExplicitO365Endpoint /d 1`
PowerShell: `Set-ItemProperty -Path “HKCU:\Software\Microsoft\Office\16.0\Outlook\AutoDiscover” -Name ‘ExcludeExplicitO365Endpoint’ -Value 1 -Type DWORD –Force`
Please note that these instructions are for Outlook 2016, Outlook 2019 and Outlook 365 and may vary for other versions. Always ensure to back up your registry before making any changes. If you’re not comfortable making these changes, please contact the PIP Helpdesk to make them for you.