Hi @Alex Rodrigue
Thank you for posting your question in the Microsoft Q&A forum.
When Azure AD Connect is enabled, Outlook may still attempt to query the Office 365 Autodiscover endpoint (autodiscover-s.outlook.com), even if the user isn’t licensed for Exchange Online. This happens because the user’s UPN now exists in Azure AD, which triggers parts of the Autodiscover process that target Office 365.
You were on the right track with your registry keys, but some settings still allow external HTTPS lookups. Specifically, setting ExcludeHttpsAutoDiscoverDomain and ExcludeHttpsRootDomain to 0 permits Outlook to reach out externally, which can redirect to Office 365 if your DNS or Autodiscover virtual directory isn’t properly isolated. Additionally, Office 2019/2021 can cache OAuth discovery behavior based on prior hybrid connectivity, which may contribute to persistent login prompts.
Here are some steps you can take to mitigate the issue:
1.Make sure that autodiscover.company.com (your primary SMTP domain) resolves only to your on-prem Exchange server for internal and external clients.
Run: nslookup autodiscover.company.com
If it resolves to Microsoft 365, update your public DNS to point to your on-prem Autodiscover service.
2.You can expand your Autodiscover exclusions to fully block cloud-based Autodiscover attempts for on-prem-only users, apply the following registry settings:
[HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Outlook\AutoDiscover] "ExcludeExplicitO365Endpoint"=dword:00000001 "ExcludeHttpsAutoDiscoverDomain"=dword:00000001 "ExcludeHttpsRootDomain"=dword:00000001 "ExcludeScpLookup"=dword:00000000 "ExcludeSrvRecord"=dword:00000000 "ExcludeLastKnownGoodUrl"=dword:00000000
3.Since you’ve already cleared Credential Manager, also reset Outlook profiles to remove any cached modern auth attempts:
-Close Outlook
-Run: %localappdata%\Microsoft\Outlook
-Rename the folder ̣(Before renaming the folder, make sure to back up the Signatures and RoamCache folders if you want to preserve your email signatures and autocomplete data.)
-Recreate profile manually using Control Panel > Mail > Profiles > Add and set it as default.
4.If your Exchange on-prem still uses Basic or NTLM authentication (not Hybrid Modern Auth), ensure Outlook isn’t attempting OAuth.
Disable OAuth to prevent Outlook from attempting modern authentication:
[HKEY_CURRENT_USER\Software\Microsoft\Exchange] "AlwaysUseMSOAuthForAutoDiscover"=dword:00000000
And also:
[HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Common\Identity] "EnableADAL"=dword:00000000 "DisableADALatopWAMOverride"=dword:00000001
This forces Outlook to use legacy authentication for on-prem profiles.
I hope this helps resolve the login loop and lockout issues.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.