Error connecting to SQL Server with Windows Authentication - sql-server

I want to connect to SQL Server with Windows authentication and create a SQL Server user.
The error I get while doing this is:
Login failed for user 'PCNAME\UserName'. Reason: The account is disabled. (Microsoft SQL Server, Error: 18470)
I also get the following error when I try to connect with PsTools:
Unable to connect: Login failed for user 'NT AUTHORITY\SYSTEM'.
Reason: The account is disabled.
What kind of process should I provide to activate the NT AUTHORITY\SYSTEM user? Or how can I act?
Thank you in advance for your help.

Well, you are trying to connect while logged on as pcname\username. If this user is not created as a Windows user in SQL Server or is disabled in SQL Server, then you will not be able to connect. What you need to do is use an authorized account to created the windows authenticated user in pcname\username in SQL Server then you will be able to connect.
As for pcname\SYSTEM, this is a built in SID that is used by services. There is no reason you could not add this as a Windows authenticated user in SQL Server.

Related

Getting SQL login failed error (18456) when connecting to Azure SQL

I am trying to connect to an Azure SQL database using SSMS. I know the credentials are correct but I keep getting the error message
Login failed for user xxxxxx
I am using SQL Server authentication and I have already added my client IP address to the server in Azure.
The error is an SQL server error, so your login request is reaching the database. It is therefore not a network problem.
There is therefore something wrong with the user account or related configuration. Things it could be:
SQL Server account authentication is not turned on (Only AD authentication by default)
The user is configured with a default database, that he does not have access to

Connecting SQL through Windows Authentication (Different server)

I want to connect the SQL Server with Windows authentication but
Database is on a different server
IIS(Application) is on a different server(Both on the same network/domain)
Want to connect the database through windows authentication.
What configuration/settings I need to do to enable this? At present, When I log in through the application, I'm getting this error message
"Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'."

Unable to login with SQL Server authentication

With Windows authentication, I am able to connect to SQL Server. Then I change password for sa, then I try to connect with SQL Server authentication, but I get an error
Login failed for user sa.
Thanks
Assuming you are entering the correct password and it still does not work, you need to enable SQL Server Authentication.

New User in SSMS Can't Login

I have installed SSMS (v17.1), created a new login at Security -> Logins, changed mode on the server (server: OWNER) to mixed mode. But the username/password combination doesn't seem to work. New Database Query -> SQL Server Authentication -> enter username/password and get error: Cannot connect to OWNER. Login failed for user 'myusername'. HELP!
According to Change Server Authentication Mode when the authentication mode is changed the server has to be restarted. Until restart SQL Server is still using Windows only authentication mode and that is what we can read is SQL Server error log as the reason of 18456 "login failed for user (...)"
I got this to work by following the instructions here: https://serverfault.com/questions/422269/where-can-i-find-the-user-in-this-iis-error-login-failed-for-user-iis-appool-w
All I did was create a user on the database, named IIS APPPOOL\DefaultAppPool, and a login, also named IIS APPPOOL\DefaultAppPool, using Windows authentication, and pointed the user at the login and it worked. Frankly, I'm still not sure why my custom SQL Server user didn't work, but at least I can move forward with my project.

Windows Authentication not working with SQL Server

I am trying to set up an SQL Server Login and User using Windows Authentication.
What I have done so far is as follows:
Added a new non-administrator account to my PC called "User1". The PC is called "DESKTOP" so the full username is "DESKTOP\User1"
Created an SQL Server login for this user using the "FROM WINDOWS" option to link the SQL Login to my PC login. The user is called e.g. "DESKTOP\User1."
Created a database level user for the SQL Server login using the "FOR LOGIN" option to link the user to the SQL Server login.
Verified that the new database user is not a member of the "SysAdmins" group and that the login is enabled and login access is allowed.
Logged out of my administrator Windows account and logged in as "User1". I successfully logged in.
Started SSMS, ensured the username set was "DESKTOP\User1" and that "Windows Authentication" was selected.
When I pressed "Connect" I was presented with an error which in the event log reads as follows:
Token based server access validation failed with an infrastructure error
Server Name: DESKTOP
Error Number: 18456
Severity: 14
State: 1
Line Number: 65536
Reading about this, there is a suggestion that this is a UAC error. So I ran SSMS as an administrator. On Windows 8.1 it then asks me to log in with the system adminstrators account - which works - but then I am logged into SQL Server as "DESKTOP\Administrator" and not "DESKTOP\User1".
Why can't Windows pass my non-administrator credentials to SQL Server and log me in? The point of this is so that (in the future "domain") users can access the SQL Server with non-administrator privileges and using Windows Authentication.
Thanks in advance.
The problem was that the BUILTIN\Users group had its login permission disabled.
This must override the individual user accounts. DESKTOP\User1 must be part of this group, and the group level permission overrode it.
I am assuming you have the following message in your SQL Server event log:
Login failed for users ‘DESKTOP\User1’. Reason: Token-based server access validation failed with an infrastructure error. Check for previous errors. [CLIENT: xxx.xxx.xxx.xxx]
Error: 18456, Severity: 14, State: 12
State 12 means that SQL Server was able to authenticate you, but weren’t able to validate with the underlying Windows permissions.
Try logging into the server as the admin and running the following:
GRANT CONNECT SQL TO [DESKTOP\User1];
GRANT CONNECT ON ENDPOINT::"TSQL Default TCP" TO [DESKTOP\User1];

Resources