About this article: This article is reviewed against the cited sources. This is source research, not lab validation. Check the stated versions and your own requirements before making changes.
Error 18452 is SQL Server saying it was handed credentials it cannot validate. Microsoft lists the message text as "Login failed. The login is from an untrusted domain and cannot be used with Integrated authentication." and the cause as a user who "attempted to sign in with credentials that can't be validated".
The words "untrusted domain" are not always literal. Microsoft's 18452 page connects the message to a login from a domain with no trust, a SQL login sent to a Windows-only server, a missing SQL login, and a domain-trust problem with account authentication or SPN visibility. Microsoft's 18456 page adds one more case that ends in the same wording: a connection to an availability group listener from the primary node. Work out which one applies before changing a trust or a registry value.
What the error means
The Microsoft Learn page for event 18452 (source MSSQLSERVER, symbolic name LOGON_INVALID_CONNECT) gives four possible causes:
- The login is a SQL Server login but the server accepts only Windows Authentication.
- The connection uses SQL Server Authentication and the login doesn't exist.
- The login uses Windows Authentication but is "an unrecognized Windows principal", meaning Windows cannot verify it, which "could be because the Windows login is from an untrusted domain."
- The issue might relate to "consistent authentication" where the trust level between domains causes failures in account authentication or in the visibility of service principal names.
Microsoft adds that similar problems can cause the less specific error 18456, whose error log state number names the failure condition (state 58, for example, is a client using SQL authentication against a server set to Windows Authentication only).
The second page, for error 18456, covers a case that produces this same message. It says that when you connect to an Always On listener from the primary node, "the connection will be NTLM", which "will engage the Loopback Check and result in a 'Login failed' error stating that the user is from an untrusted domain."
Likely causes
| Cause | What you see | How to confirm |
|---|---|---|
| SQL login sent to a Windows-only instance | 18452, or 18456 with state 58 | Instance Security page shows Windows Authentication mode |
| SQL login does not exist | The login name has no domain part | Look in Security, then Logins |
| Windows account from a domain with no trust to the SQL Server's domain | Cross-domain user fails; same user works from a workstation in the right domain | Check trusts; test with a login from the SQL Server's own domain |
| Client logged on to the wrong domain or an unexpected account | The domain in the message is not the one the user expects | Read the domain named in the message and in the error log |
| Listener reached from the primary node (documented on the 18456 page) | Works from other machines and from the secondary, fails on the primary | Connect to the node name instead of the listener name from that node |
Prove the cause before changing anything
Read-only steps, in this order.
- Read the SQL Server error log at the time of the failure. Find the line that reads
Error: 18452, and any 18456 line beside it, together with the "Login failed" text. The state number and any Reason text on an 18456 line are described on Microsoft's 18456 page. A name with no domain means a SQL login; a name with a domain means a Windows account. - Compare from a different place. From a machine in the SQL Server's domain, connect with the same Windows account. If that works, the account is fine and the path from the failing client is the cause. If a connection made on the primary node to the listener fails while the same connection from another machine works, suspect the loopback check that Microsoft describes for the listener case.
- Look at the name used. Note whether the failing connection string uses the listener name, and whether the failing connection is made from the primary node itself.
- Check the SQL Server's authentication mode in SSMS: server Properties, then Security. For a SQL login, also check that the login exists.
- Check SPNs. Microsoft's 18456 page says
SETSPN -Xand-Qare useful for finding duplicate or misplaced SPNs. Read the output for an SPN registered on more than one account before changing anything. - Check domain reachability. Microsoft's 18452 page says you can run the
setspnandrunascommands to test the trust relationship independent of your application, but the page gives no syntax. Use the vendor documentation for those tools rather than an assumed command line.
A good result for step 2 is a successful sign-in under the same account. A bad result is the same 18452 text. Microsoft's page shows no sample output for these tests.
Fix
SQL login to a Windows-only server. Either change the application to Windows Authentication (Microsoft gives INTEGRATED SECURITY=SSPI for OLE DB and TRUSTED_CONNECTION=YES for ODBC) or enable SQL Server and Windows Authentication mode.
Disruptive step: changing the authentication mode needs a service restart that drops all connections, and an enabled mixed mode lets SQL logins in for every application. To back out, set the mode back and restart.
Missing login. Create the login or correct the spelling in the connection string. If it is a Windows login, grant access directly or through a local or domain group that may connect.
Disruptive step: creating a login or adding an account to a group grants access to the instance. Grant only what the application needs. To back out, drop the login you created or remove the account from the group; check change records before dropping a login you did not create.
Wrong domain. Sign in with an account from the correct domain. Microsoft's guidance for a cross-domain group is that the group must be in the SQL Server's domain, not the user's domain, so its membership can be resolved.
Availability group listener from the primary node. Microsoft's 18456 page instructs you to type the listener NetBIOS name and fully qualified name into the BackConnectionHostNames registry key on all machines in the availability group. Microsoft's separate loopback page describes the steps for that key: create a multi-string value named BackConnectionHostNames under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0, enter each name on its own line, and restart the computer. If BackConnectionHostNames exists as a REG_DWORD, delete it first.
Disruptive step: this is a registry edit plus a restart of every machine you change. Microsoft advises backing up the registry first, and describes the change as a workaround that lowers a protection, to be evaluated for risk first. A restart drops every connection to that node; on the primary it also takes the databases away from applications until the node returns or the group fails over, and Microsoft's pages give no restart order, so agree the order and window with the availability group owner. To back out, delete the value or remove the names and restart again.
The loopback page's Resolution begins "To resolve this problem, set the DisableStrictNameChecking registry entry to 1." The page gives no registry path for that entry, and the 18456 page names only BackConnectionHostNames for the listener case, so no steps are given here for DisableStrictNameChecking. Read the loopback page before editing and stop if its steps do not match your Windows Server version.
The same loopback page also describes a second method that sets DisableLoopbackCheck to 1. Microsoft says this reduces security and does not recommend it as a workaround, so no steps are given for it here.
Confirm the fix
- Repeat the same connection, with the same alias and account, from the same place. The error log should have no new 18452 or 18456 entry.
- After a registry change and restart, test every alias you added, not only one.
- For an availability group, test from the primary node, from a secondary and from an application server.
Example (illustrative): availability group listener aglistener.contoso.local (short name aglistener) fronts nodes sql01 and sql02 in CONTOSO. A maintenance script that runs on sql01 connects to aglistener.contoso.local and gets 18452, while the same script on app01 works. Microsoft's guidance applies: add aglistener and aglistener.contoso.local to BackConnectionHostNames on both nodes. That is 2 names on 2 machines, so 4 entries in total, then a restart of each node. Agree the restart order and window with the availability group owner first, because a restart drops every connection to that node.
What to watch afterwards
- Watch for 18452 and 18456 entries from the same CLIENT address.
- Record the listener names that applications use, and add any new listener name to
BackConnectionHostNameson every node in the group. - Keep a list of machines where
BackConnectionHostNameswas set, and remove names for retired aliases. - If Microsoft's cross-domain note applies, check group membership after changes in either domain.
Read next
Related articles you may want next.
- TroubleshootingSQL Kerberos After Migration: Check SPNs and NTLM UseTrace client names, SQL service identities and SPNs to explain failed Kerberos authentication after migration without weakening authentication.Read article
- Backup & RecoveryAfter the restore: why a Windows server can lose its trust with the domainDiagnose a restored Windows member server’s broken domain trust, including machine passwords, connectivity and identity conflicts before repair.Read article
- TroubleshootingKRB_AP_ERR_MODIFIED: duplicate SPNs and the wrong account behind a nameUsers get password prompts or access denied on a web, file or app service, and the System log shows Kerberos event 4 KRB_AP_ERR_MODIFIED. Find which account holds the service name, remove duplicates with setspn, and confirm Kerberos works.Read article
Risks and limits
These commands have not been run or lab-tested. Microsoft's loopback page is titled for Windows Server 2003 Service Pack 1, and its header reads "Applies to: Supported versions of Windows Server". Check the registry paths against your Windows Server version before editing. The page describes a UNC share path symptom (access denied, event 537), not SQL error 18452; the 18456 page is what ties it to the listener case. The 18452 page gives the causes above without a step-by-step test procedure. A failure that reads NT AUTHORITY\ANONYMOUS LOGON has its own causes on the 18456 page (a service calling another on the same computer, double-hop delegation, LANMAN compatibility level) and is not covered here.
Do not disable the loopback check first. Do not create a domain trust to fix a problem that is a name or alias. Do not enable sa or mixed mode to get a connection working.
Sources
- MSSQLSERVER_18452 — Microsoft Learn, page dated 2024-11-09, accessed 18 November 2026
- MSSQLSERVER_18456 — Microsoft Learn, page dated 2025-11-25, accessed 18 November 2026
- Error message when you try to access a server locally by using its FQDN or its CNAME alias — Microsoft Learn, page dated 2026-02-12, accessed 18 November 2026
This article was originally published on .