![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I'm attempting to logon to SQL Server remotely. I'm passing my windows credentials via the connection string (using the User ID and Password keywords) but I see this in the server's event log afterwards: "An attempt to login using SQL authentication failed. Server is configured for Windows authentication only." Is there a way to log on using my Windows credentials. I have a Windows account on the Server. Thank you. When using Windows authentication, you do not (and cannot) pass a username |
#3
| |||
| |||
|
|
When using Windows authentication, you do not (and cannot) pass a username and password at all. The server will take care of authentication for you "under water". This, however, requires that you either have a domain account if you want to log on remotely, or that the machine you log on from has the "same" local account (identical username/password) as the account on the SQL Server and you are logged on as that account (I haven't tester whether the latter works, but it should). Usually, if you have only local access, you would set up a Remote Desktop session to the machine instead and access SQL Server from there. |
#4
| |||
| |||
|
|
When using Windows authentication, you do not (and cannot) pass a username and password at all. The server will take care of authentication for you "under water". This, however, requires that you either have a domain account if you want to log on remotely, or that the machine you log on from has the "same" local account (identical username/password) as the account on the SQL Server and you are logged on as that account (I haven't tester whether the latter works, but it should). Usually, if you have only local access, you would set up a Remote Desktop session to the machine instead and access SQL Server from there. Thanks for the feedback. This is what I figured but I don't understand why it doesn't allow the explicit passing of alternate Windows credentials. It will implicitly grab my credentials from the current thread whether I'm logged into a domain or a local account, but not allow me to explictly pass those credentials in. In my case the server is not part of a domain so it forces me to create a matching account name and password on my current machine and log onto to that account (or impersonate it), instead of simply allowing me to pass those credentials in on-the-fly. I don't see why this restriction exists. In any case, thanks again. |
#5
| |||
| |||
|
|
Because the server isn't configured for Mixed Mode. Mixed mode just allows SQL authentication to coexist with Windows |
#6
| |||
| |||
|
|
When using Windows authentication, you do not (and cannot) pass a username and password at all. The server will take care of authentication for you "under water". This, however, requires that you either have a domain account if you want to log on remotely, or that the machine you log on from has the "same" local account (identical username/password) as the account on the SQL Server and you are logged on as that account (I haven't tester whether the latter works, but it should). Usually, if you have only local access, you would set up a Remote Desktop session to the machine instead and access SQL Server from there. Thanks for the feedback. This is what I figured but I don't understand why it doesn't allow the explicit passing of alternate Windows credentials. |
|
It will implicitly grab my credentials from the current thread whether I'm logged into a domain or a local account, but not allow me to explictly pass those credentials in. |
#7
| |||
| |||
|
|
On 2009-12-14 1:28, Jay wrote: [SQL server won't accept a login and password for Windows authentication] Because the server isn't configured for Mixed Mode. Mixed mode just allows SQL authentication to coexist with Windows authentication. Passing in a login name and a password will still only work for SQL accounts, and Windows accounts and SQL accounts do not correspond. That's not to say mixed mode couldn't be a solution for this particular scenario. If your machine isn't joined to a domain, Windows authentication is really not that much better, except for relieving applications of the need to store explicit credentials (which is still nothing to scoff at). -- J. |
#8
| |||
| |||
|
|
The OP said: "An attempt to login using SQL authentication failed. Server is configured for Windows authentication only." No, that's what the OP said that *SQL Server* said. The OP intended to log |
|
So, Mixed Mode would solve his problem. |
#9
| |||
| |||
|
|
Thanks for the feedback. This is what I figured but I don't understand why it doesn't allow the explicit passing of alternate Windows credentials. |
|
When using Windows authentication, you do not (and cannot) pass a username and password at all. The server will take care of authentication for you "under water". This, however, requires that you either have a domain account if you want to log on remotely, or that the machine you log on from has the "same" local account (identical username/password) as the account on the SQL Server and you are logged on as that account (I haven't tester whether the latter works, but it should). Usually, if you have only local access, you would set up a Remote Desktop session to the machine instead and access SQL Server from there. Thanks for the feedback. This is what I figured but I don't understand why it doesn't allow the explicit passing of alternate Windows credentials. It will implicitly grab my credentials from the current thread whether I'm logged into a domain or a local account, but not allow me to explictly pass those credentials in. In my case the server is not part of a domain so it forces me to create a matching account name and password on my current machine and log onto to that account (or impersonate it), instead of simply allowing me to pass those credentials in on-the-fly. I don't see why this restriction exists. In any case, thanks again. |
#10
| |||||
| |||||
|
|
Basically, just because Windows authentication doesn't support this directly. |
|
You cannot log on remotely using a local account. It works if you set up a "mirror" local account, but that's the only circumstance under which that will work. I couldn't tell you how exactly all of this works out security-wise. |
|
If by "it" you mean SQL Server, then no. This is done by the local and remote security systems, not SQL Server. And the "credentials" being grabbed are not your user name and password stored somewhere -- they're tokens, verified by a server. |
|
This is why your token is only good if it's backed by a domain account: it couldn't be verified by the remote machine otherwise. |
|
The whole "mirror account" shenanigan only works because both machines come to the same conclusion as to the validity of the token if both are using the same credentials (or at least, that's how it should work). Passing in explicit credentials (as in username and password) is a big no-no in the Windows authentication world. |
![]() |
| Thread Tools | |
| Display Modes | |
| |