How to Fix SQL Server Error 18452 (Msg 18452)

Published
Length
3 min read

Luis Felipe Dias

All posts

You get sql server error 18452 when a login comes from an untrusted domain. Fix it by repairing the domain trust or switching the app to SQL login mode. The server returns message 18452 with a severity level of 14. The text states that the login cannot be used with Integrated login. This stops users and apps before they reach any data. What causes sql server error 18452 in production This failure happens during the first handshake between the client and the database engine. The client tries

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

You get sql server error 18452 when a login comes from an untrusted domain. Fix it by repairing the domain trust or switching the app to SQL login mode.

The server returns message 18452 with a severity level of 14. The text states that the login cannot be used with Integrated login. This stops users and apps before they reach any data.

What causes sql server error 18452 in production

This failure happens during the first handshake between the client and the database engine. The client tries to log in with Windows credentials instead of a password. The database checks the domain of that Windows account against its own domain list.

If the client sits in a separate workgroup, the domain check fails right away. It also fails when two domains lack an active trust link between them. A broken Kerberos ticket or wrong service principal name can trigger this same message.

Sometimes a developer tests an app on a local machine outside the corporate network. The app string asks for Windows login, so the server rejects the untrusted host. Cloud migrations often cause this when servers move to new virtual networks.

How to diagnose and fix the login failure

Start by checking the server error log to see the exact client host address. Confirm whether the client machine and the database host share the same Windows domain. If they belong to the same domain, ask your network team to check Kerberos.

When the client must run outside the domain, use a SQL login with a password. The database engine must run in mixed mode to accept both login types. Create a login in the master database for users who need many databases.

Kubernetes API Server Access + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

For access to one or a few databases, you can use a contained database user. This is a SQL user with a password that does not need a master login. An admin must first turn on contained databases on the server and database.

How to scope permissions after fixing the login

Do not fix a login error by adding the account to the owner role. Members of the owner role can do all maintenance tasks and drop the database. Instead, map the login to a database user with only the rights it needs.

Database roles have fixed permissions that you cannot change, and all roles have connect rights. Assign the data reader role when a person or app only needs to read tables. Members of this role can read all data from all user tables and views.

If the app must change rows, add the user to the data writer role. This role lets the user add, delete, or change data in all user tables. You can also use deny roles to block read or write access to sensitive tables.

Add runtime guardrails beside SQL Server

Role grants and network rules are needed setup for SQL Server. Still, an allowed user or agent tool can send a bad delete or read raw customer fields over a valid session. In practice, hoop.dev sits inline in the TDS protocol beside the database as a sidecar for your SQL Server. For every query an agent or human runs in production, hoop.dev decides whether to pass, mask, block, or escalate it for review.

With hoop.dev SQL Server controls, rules refuse banned statements before they run, hold risky queries for human review, and mask matched sensitive values in supported result columns in memory. Furthermore, hoop.dev holds SOC 2 Type II and generates evidence for HIPAA, PCI DSS, SOX, and GDPR audits. See the source on GitHub.

Frequently asked questions

What does severity 14 mean for message 18452?

Severity 14 means the error is a security or permission issue caused by the user. The database engine is healthy, but it blocked the login due to domain rules.

Can I fix error 18452 without joining the Windows domain?

Yes, you can switch the client to use a SQL login with a password. You can also set up a contained database user for a single database.

Why did error 18452 start happening on an existing server?

A domain trust between two networks may have expired or broken after a network change. It also happens when a service account password changes or Kerberos records go stale.

The query runs. The emails stay hidden.