Login Failed: The Login Is From an Untrusted Domain (SQL Server Error 18452)

🚨Part of the SQL Server Errors series, the exact messages and what actually causes them.Related pillar: Security

Msg 18452  ·  Level 14  ·  State 1
Login failed. The login is from an untrusted domain and cannot be used with Integrated authentication.
⚡Check the account before you call the domain team. When I see this it is nearly always a locked-out account or a changed password, then a client that is not on the domain, so start with those 2 checks. One machine failing is a client problem; many at once earns the domain call.

The word “domain” sends everyone to the domain admins, and most of the time the domain is fine. The client offered Windows credentials that SQL Server could not validate, and in a corporate environment that is usually an account that is locked out or a password that changed, with a machine that is not on the domain a close second. The checks below take about 2 minutes each and run in the order that finds it.


The Usual Causes

In rough order of how often they turn out to be the answer:

Stale Credentials on the ClientMOST COMMON

The account is locked out, or its password changed while a session, saved connection, scheduled task or service kept presenting the old one. In a corporate environment this is the cause I see most: the user is locked out or typed a bad password, and the message makes it sound like a domain fault.

How you tell

One account or one machine fails while every other client connects normally. The service desk or AD team sees the account locked or the password recently changed, and unlocking it or signing out and back in on the failing machine clears it.

The Client Is Not on the DomainMOST COMMON

A laptop, a jump box, or a container trying Integrated authentication with a local Windows account. A local account means nothing to the server’s domain, and this is the exact message it earns.

How you tell

whoami on the failing client comes back with a machine name where a domain name should be, hpai01\peter rather than DOMAIN\peter. Nothing on the server side will fix that.

Connecting by IP Address or a DNS AliasCOMMON

Kerberos needs a name to find a service principal, so an IP connection falls back to NTLM, and where NTLM is blocked by policy the attempt surfaces as this error rather than something clearer. A DNS alias does the same thing more quietly: sqlprod.contoso.com pointing at SQL01 asks Kerberos for an SPN under the alias name, nobody registered one, and the fallback fails the same way.

How you tell

That session negotiated NTLM and never KERBEROS, and either the address it connected to has no name in it, or the same client works by the server’s real hostname and fails by the alias. Check 3 below is where you read the scheme.

NTLM Is Blocked and No SPN Is RegisteredCOMMON

Kerberos never worked because the service account never registered its SPNs, and nobody noticed because Windows authentication quietly fell back to NTLM for years. Then a security baseline or hardening change sets the Restrict NTLM policies to Deny, and every remote Windows login fails from the same moment while local connections carry on. Nothing changed on the SQL Server, which is why it is the last place anyone looks.

How you tell

Many clients fail at once, the auth_scheme query shows NTLM and no KERBEROS rows, and the error log from the last startup says the SPN could not be registered (Check 4). The fix is the SPNs, not the policy: register them against the account that runs the service, then reconnect by name.

A Genuine Trust or Secure-Channel ProblemLESS COMMON

Possible, and worth checking last unless several machines started failing together. The companion error in that family is the SSPI handshake failure (17806).

How you tell

Checks 1 to 3 come back clean on more than 1 client, the SPNs are registered, and they all started failing at the same moment. Until that is true, it is one of the 4 above.

Microsoft’s reference covers error 18452 in full, and it also lists 2 SQL-login causes: an instance set to Windows authentication only, and a SQL login that does not exist. On any supported version those 2 come back as 18456 (states 58 and 5 in the error log), not 18452. If you are using SQL authentication, you want Login Failed (18456).


What To Check, In Order

Each of these is a 2-minute check, and they are ordered so the common causes go first:

1. Is the account locked out, or did its password change? Ask the user, then ask whoever holds the directory. A lockout or a changed password with something on that client still presenting the old one is the answer more often than everything else on this page, and it only needs an unlock or a sign out and back in.

2. Is the failing client using a domain account? whoami on the client answers it. A MACHINE\user result instead of DOMAIN\user is the whole diagnosis. If it is a domain account and only this machine fails, klist purge clears a stale Kerberos ticket, nltest /sc_query:DOMAIN confirms the machine’s own trust with the domain, and on a VPN nslookup DOMAIN has to return domain controllers, because a client that cannot find one cannot get a ticket.

3. Is the connection by name or by IP? Check the connection string. If it is an IP, test the same connection with the server’s DNS name before touching anything else, and read what the working sessions negotiate on the server:

-- Windows connections that ARE working: which scheme did they negotiate?
SELECT auth_scheme, COUNT(*) AS connections
FROM sys.dm_exec_connections
GROUP BY auth_scheme;

A server showing only NTLM where you expect KERBEROS is a standing clue that names and SPNs, not passwords, are where this error comes from. Kerberos vs NTLM covers what to do with that result.

4. Did it fail for one client or many at once? One = that client’s account, token or configuration. Many at the same moment = server-side or domain-side, and now the domain conversation is justified. Before you make that call, read what the server logged about its SPNs at startup:

-- SPN registration at the last startup
EXEC xp_readerrorlog 0, 1, N'could not register';

A row that says SQL Server could not register the Service Principal Name (SPN), and that this might cause integrated authentication to use NTLM instead of Kerberos, means Kerberos has never worked here. With NTLM now refused, that is the NTLM card above, and the SPNs are the fix.


The Fixes

Match the fix to the cause you found:

  • Locked out or changed password: get the account unlocked or the password reset, then sign the account out and back in on the failing client, and restart any service or scheduled task still running with the old password.
  • Not on the domain: use a domain account. Where the machine cannot be domain-joined, runas /netonly presents domain credentials across the network only, which sidesteps the local-account problem. SQL authentication is the other way out, stated as a decision rather than a fix. For an application in a domain the server will never trust, a contained database user with a password keeps that decision inside one database.
  • Connecting by IP or an alias: connect by the server’s DNS name instead, or register an SPN for the alias name against the service account.
  • NTLM blocked and no SPN: register the SPNs and reconnect by name. Relaxing the NTLM policy puts the old fallback back, it does not fix it.
  • Many clients at once: go to the domain team with evidence, which client, which account, name or IP, one machine or many. Microsoft’s page suggests setspn and runas to test the trust outside your application.
🔑Not on the domain? Run SSMS as the domain user. Open SSMS as a Different Domain User covers runas /netonly, which presents domain credentials over the network from a machine that is not joined to it.

What You Can Fix as the DBA

As DBAs we are not normally Domain Admins, so when the cause is the account, a lockout or a password that changed, the fix sits with the service desk or the AD team: unlock it, reset it, and have the user sign out and back in. What you own is the evidence that gets that ticket actioned quickly: which account, which client, name or IP, one machine or many, and what the auth_scheme query shows for the sessions that do work.

In my career I have been a Domain Admin several times at other companies, and the smaller the company the more likely the DBA holds rights well beyond the database. If that is you, the unlock is yours to do, and the evidence above is still worth a line in the ticket. Even sysadmin on the instance is heading the same way: read-only roles day to day, with write rights activated against a change order when you need them, so a fix here is often a ticket before it is a command.


When It Is Not This

If the message names a specific reason, a disabled account (18470) or an expired password (18487, 18488), you are in a more specific branch of the login-failure family. If the connection dies before authentication starts, with TLS or handshake wording, that is the pre-login handshake error rather than anything about trust.


Frequently Asked Questions

Do I need the domain admins?
Usually not first. One failing client is nearly always that client or that account: a lockout, a changed password still cached somewhere, a local account, or an IP connection string. Many clients failing at the same moment is when the domain conversation earns its place.
Why does connecting by IP matter?
Kerberos identifies services by name, so an IP connection cannot use it and falls back to NTLM. Where policy restricts NTLM, that fallback surfaces as this error instead of working quietly.
Can I just switch to SQL authentication?
It makes the error go away because it stops using Windows identities entirely. That is sometimes the right call for a machine that cannot be domain-joined, but state it honestly as a decision, not a fix.
I am using SQL Server authentication. Can I get 18452?
Not with a SQL login on a supported version. A SQL login against a Windows-only instance logs 18456 state 58, and a missing SQL login logs 18456 state 5. 18452 means Windows credentials were offered and could not be validated. So check the connection string first: with Integrated Security=True or Trusted_Connection=True in it, the user id and password are ignored and Windows authentication runs as whatever account the process runs under. Remove the flag. Otherwise start at Login Failed (18456).
Will ticking Trust Server Certificate fix it?
No. That option only skips validation of the server’s TLS certificate, which is the certificate chain error. It has nothing to do with how Windows credentials are checked, so 18452 stays exactly as it was.
It only fails from a Java application.
On Windows, integratedSecurity=true makes the driver present the identity of the process, and on a host that is not domain-joined that is not a domain account, so SSMS on a domain desktop connects while the application on the off-domain host gets 18452. On Linux the default native authentication is not available at all, so the failure comes from the driver or Kerberos before SQL Server sees a login. Use Kerberos with authenticationScheme=JavaKerberos, or a SQL login.

Where To Go Next

Which neighbour you need depends on what the checks above found:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *