Login Failed: The Account Is Disabled (Error 18470)

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

Msg 18470  ·  Level 14  ·  State 1
Login failed for user ‘ErrDemoDisabled’. Reason: The account is disabled. Msg 18470, Level 14, State 1
Enable is one line; the real question is why it was off. sys.server_principals modify_date tells you when it changed, and the error log entry carries the client IP of whatever is still knocking.

This is the friendliest member of the login-failure family, because it tells you exactly what is wrong. Unlike a wrong password, where the client gets a deliberately vague message and the real reason hides in the server error log, a disabled account announces itself. On a current driver the client sees the reason directly. This is the exact client output from the lab repro:

Sqlcmd: Error: Microsoft ODBC Driver 18 for SQL Server : Login failed for
user 'ErrDemoDisabled'. Reason: The account is disabled..

And the server error log entry, same attempt:

Logon    Login failed for user 'ErrDemoDisabled'. Reason: The account is
disabled. [CLIENT: 192.168.1.109]

So when someone reports “login failed” and the word disabled appears anywhere, you can skip the whole password-reset dance. The account exists, the password may even be right, and none of that matters until the login is switched back on.


Why This Happens

Logins do not disable themselves. Someone or something did it:

  • A leaver or security process. Disabling instead of dropping is the correct practice for accounts that might own objects or might need to come back, so tidy environments produce this error by design.
  • The sa lockdown. Disabling sa is standard hardening, and anything still configured to connect as sa starts failing with exactly this the moment it happens.
  • Policy lockout confusion. An account locked out by Windows password policy reports a different reason (and a different state), but the two get mixed up in tickets constantly. The message text settles it: disabled means disabled.
  • A restore or migration. Logins scripted from another server with Generate-LoginScript style tooling carry their disabled state with them, which is correct behaviour that surprises people.

Confirm It in One Query

SELECT name,
       is_disabled,
       type_desc,
       modify_date
FROM sys.server_principals
WHERE name = N'ErrDemoDisabled';

is_disabled = 1 is the whole diagnosis, and modify_date tells you when it changed, which is usually the fastest route to who changed it. The default trace and the server audit, if one is configured, hold the rest of that story.


The Fix

ALTER LOGIN [ErrDemoDisabled] ENABLE;

That is genuinely all, but before running it, ask the question the error is really raising: was this account disabled on purpose? If it belonged to a leaver, the fix is not enabling it, the fix is finding out what is still trying to use it. The server error log’s [CLIENT: ip] suffix in the entry above names the machine making the attempts.


When It Is Not This

If the message says nothing about the account being disabled you are in ordinary 18456 territory, where the client is told State 1 and the truth lives server-side. And if logins fail in a burst across many accounts, look at the domain and the server rather than any single login.


Common Questions

Why does the client see the reason when a wrong password stays vague?
A wrong password is deliberately vague so the message cannot be used to probe accounts. A disabled account is treated as safe to announce on current drivers, which makes this the one login failure you can diagnose from the client message alone.
Should I enable it or recreate it?
Enable it. Dropping and recreating a login generates a new SID for SQL logins, which orphans every database user mapped to it. Enabling changes nothing but the flag.
How do I find out who disabled it?
Start with modify_date in sys.server_principals for when. The default trace holds recent ALTER LOGIN events, and a server audit, if configured, has the full answer.

Related Scripts

Comments

Leave a Reply

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