I have a SQL Server 2005 named instance using Windows Authentication with domain groups serving as logins. The domain structures are as follows:
Forest1 Forest2
/ \ |
Domain1 Domain2 Domain3
Objects are organized in the following domains:
Forest1.Domain1
Forest1.Domain2
Forest2.Domain3
All my users exist in Domain1
and Domain3
but the SQL Server box exists in Domain2
. As such, my logins are domain groups in Domain2
. When a user in Domain1
is added to a domain local group in Domain2
and attempts to connect using TCP/IP protocol to the SQL Server instance, he receives the following error message:
Cannot connect to <instance>. Login failed for user 'Domain1\userName'. (Microsoft SQL Server, Error: 18456)
Other things I've tried:
If I add the user as a login explicitly, he can connect.
If I add a Domain1
global group of
which the user is a member as a login
explicitly, he can connect.
If I add a Domain1
global group of
which the user is a member as a
member of the Domain2
domain local
group used as a login, he cannot
connect.
EDIT: If I add the Domain2
domain local group to the Demote Desktop Users group on the Domain2
server hosting the SQL Server instance, the Domain1
user can successfully connect to the server - I can also connect to the instance locally as the Domain1
user (just not remotely).
EDIT: If I add the Domain2
domain local group to a local server group and create a SQL Server login for that local server group, the Domain1
user still cannot connect to the instance remotely.
EDIT: If I change the connection network protocol to "Named Pipes", the Domain1
user can successfully connect remotely.
From what I understand (referencing these TechNet articles: Group Scope and Nesting Groups), the domain group MUST be a domain local group in order to include users from both Domain1
and Domain3
.
How can I use a domain group as a SQL Server login using Windows authentication such that the domain group can contain users from both Domain1
and Domain3
and users can connect remotely via TCP/IP?
MORE NOTES
Domain1
UPDATE
Changing the SQL Service instance service account to be in Domain2
seems to have resolved the issue. I'll investigate further and post back my findings!
A connection made using Windows Authentication is sometimes called a trusted connection, because SQL Server trusts the credentials provided by Windows. By using Windows Authentication, Windows groups can be created at the domain level, and a login can be created on SQL Server for the entire group.
Change authentication mode with SSMSIn SQL Server Management Studio Object Explorer, right-click the server, and then click Properties. On the Security page, under Server authentication, select the new server authentication mode, and then click OK.
Windows authentication is generally more secure in SQL Server databases than database authentication, since it uses a certificate-based security mechanism. Windows-authenticated logins pass an access token instead of a name and password to SQL Server.
Windows authentication uses a series of encrypted messages to authenticate users in SQL Server. When SQL Server logins are used, SQL Server login names and encrypted passwords are passed across the network, which makes them less secure.
As mentioned in my question update, changing the service account to be in Domain2
resolved the issue. So what was going on?
The Problem - Explained
From what I can tell (also with help from a Microsoft representative), because the service account was originally a Domain1
user, it could not determine what domain local groups the connecting user is a member of when the user is authenticating via Kerberos. The primary lead that this was a Kerberos issue was when I successfully connected using "Named Pipes" as this uses NTLM authentication.
Overall Solution
To bring it all together, to successfully add users from Domain1
and Domain3
as members of groups in Domain2
so that the groups can be used as SQL Server logins with Windows authentication, here's a list of requirements (or at least strongly encouraged):
Domain2
trusts Domain1
and Domain3
Domain2
must be scoped "Domain Local"
Domain1
and Domain3
Domain2
user as the service account identity
Domain2
user account.Domain2
service account
Domain2
service account to be trusted for delegation
Domain2
groups and any Domain1
or Domain3
members should be able to connect remotely!Note
As always with any remote network activity, check your firewalls to ensure your SQL Server ports are not blocked. Although the default port is 1433, check to make sure your port is in the clear.
Ok, I met the issue as well in 2017, hard to find any solution, finally, I figure it out only for my case.
My environment,
Forest 1 (Domain1) --- TRUST --- Forest 2(Domain2)
I have a service account in Domain2 trying to log in SQL server in Domain1 by using Windows Authentication.
And, following error message pops up.
Login failed. The login is from an untrusted domain and cannot be used with Windows authentication. (Microsoft SQL Server, Error: 18452)
The solution is simple enough, on domain1, open active directory domains and trusts tool,
Trusts -> outgoing trusts -> properties -> authentication -> change to "Forest-wide authentication"
My problem solved.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With