Fix: Outlook 2016 keeps asking for password or goes to temporary profile

Fix: Outlook 2016 keeps asking for password or goes to temporary profile

So, yet again, Microsoft have introduced an awesome, thought-inspiring problem which is incredibly difficult to troubleshoot. Outlook 2016 will consistently ask users for authentication to their mail account but never accept it. Alternatively, it may make mail almost unusable by forcing you to use a temporary profile. If this is the case, you will be prompted with a popup like so:

The problem appears to have been introduced with version 16.0.6741.2017, but I could be wrong.

What is the cause?

This issue, like most, requires special circumstances for it to be evident.
First, you must be on the new version of Outlook 2016, then you must also be using Office 365 for Licensing, but not hosted Exchange (important!). This is where the problem is introduced.

Part of the new Outlook 2016 patch tells Outlook to, despite anything else you tell it, always check Microsoft’s own Office 365 autodiscover, first.

Now, in most instances, you’ll either be fully hosted with Office 365 and actually want Outlook to behave like this (making setups nice and quick), or you’ll be fully self-serviced with your own environment.

In some cases, however, you may have your own Exchange environment, but be using O365 for its easy management of licensing. This is where this mechanism falls short.

Because Outlook now checks Microsoft’s own O365 autodiscover first, and your email address is in fact registered there (assuming you auth’d your domain with your O365 account), it will match this account and attempt to authenticate. If your password to the O365 account is the same as your password to your AD/Mailbox (for security reasons, this is bad, but I have seen it done, time and time again), it will succeed and present you with this popup, rendering Outlook basically unuseable:

If however, you’re smart and have a different password on your accounts, Outlook will simply hammer away, constantly asking you for a password, as authentication continues to fail.

How do we fix it?

Thankfully, it is a simple fix, once we know what it is! All we need is to create one registry key. That’s it.
(this took me hours upon hours to find)

Navigate to HKCU\Software\Microsoft\Office\16.0\Outlook\Autodiscover and create the following DWORD:

Name: ExcludeExplicitO365Endpoint
Value: 1

Alternatively, here’s a quick, one-line Powershell command to do the same:

Set-ItemProperty -Path “HKCU:\Software\Microsoft\Office\16.0\Outlook\AutoDiscover” -Name ‘ExcludeExplicitO365Endpoint’ -Value 1 -Type DWORD -Force

Now, if you received the “Temporary Mailbox” popup, you’ll probably need to go ahead and create yourself a new Outlook profile and reconfigure your mail account. If, however, your passwords were not the same, and you were just being pestered with constant password prompts, you should now be able to restart Outlook and continue on with your work, now in a somewhat sane mindset.