简体   繁体   English

如何查询与SQL Server用户关联的Active Directory帐户?

[英]How can I query an which Active Directory account is associated with a SQL Server user?

I have have two SQL Server's that I primarily use (a 2005 instance and a 2000.) My permission structure works as such-- 我主要使用两个SQL Server(一个2005实例和一个2000。)我的权限结构是这样的:

First I create an Active Directory Group and then I add all necessary user's to it. 首先,我创建一个Active Directory组,然后将所有必需的用户添加到该目录中。 Then, I go to SQL-MS and I add a user by select the Windows Authentication option, and then selecting the AD Group which I just created. 然后,转到SQL-MS,然后通过选择Windows身份验证选项,然后选择刚创建的AD组来添加用户。 Impertinent to this post but I then associate the new login account with all of the necessary data tables, views and SPs. 无关紧要的帖子,但我随后将新的登录帐户与所有必要的数据表,视图和SP关联。

After selecting the group, I have always left the Login name field as the name of the AD Group for reference. 选择组后,我始终将“ 登录名”字段保留为AD组的名称以供参考。

Recently I have had an AD Group renamed. 最近,我将AD组重命名。 The database has continued to work and, some how, SQL Server knows which AD Group to associate the SQL login. 数据库已继续工作,并且在某种程度上,SQL Server知道了与SQL登录关联的AD组。 My problem is that the login name hasn't updated in SQL Server so I have no clue which AD Group is associated with the SQL Server Login account! 我的问题是SQL Server中的登录名尚未更新,因此我不知道哪个AD组与SQL Server登录帐户相关联!

Is there a query which I can run, or is there a setting buried some where that could help me discover which AD Group is associated with this account? 是否有我可以运行的查询,或者是否有设置隐藏在某些地方可以帮助我发现哪个AD组与此帐户相关联?

-- EDIT -- - 编辑 -

Thank's responders for your answers. 感谢您的回答。 You've answered this question, however, it's propgated another question posted here . 你已经回答了这个问题,但是,它的propgated另一个问题贴在这里

The mapping between the AD group and the SQL Server login is being done using the group's SID . AD组和SQL Server登录名之间的映射是使用该组的SID完成 You can see the list of logins with their SIDs using sys.server_principals . 您可以使用sys.server_principals查看带有其SID的登录列表。 If you want to change the name of the existing login, you can use ALTER LOGIN . 如果要更改现有登录名,则可以使用ALTER LOGIN

You can check that Windows groups you have defined on your system as login; 您可以检查已在系统上定义为登录名的Windows组。

SELECT *
FROM sys.server_principals
WHERE type_desc = 'WINDOWS_GROUP'

This works on SQL Server 2005 and newer only. 这仅适用于SQL Server 2005及更高版本。

But you won't get the actual AD group name - only the "SID" for that group .... 但是您将无法获得实际的广告组名称-只有该组的“ SID”...。

The whole security system was very different on SQL Server 2000 - I don't think there's a 1:1 equivalent query for that old dinosaur :-) The best I can think of would be: 整个安全系统在SQL Server 2000上是非常不同的-我不认为该旧恐龙会有1:1等效查询:-)我能想到的最好的办法是:

SELECT *
FROM master.dbo.sysxlogins
WHERE password IS NULL 
  AND name IS NOT null

But unfortunately, there's no way I would be aware of to separate between Windows users and Windows security groups here.... 但是不幸的是,我没有办法在这里区分Windows 用户和Windows安全

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如果用户通过 Active Directory 身份验证,如何将 ODBC 连接字符串发送到 SQL 服务器? - How can I send an ODBC connection string to an SQL server if the user is authenticated by Active Directory? 如何在没有Windows身份验证的情况下使用Active Directory用户在SQL SERVER 2008中进行身份验证 - How i can authenticate in SQL SERVER 2008 with Active Directory User but without Windows Authentication 如何在SQL Server中找到为我的用户帐户提供的访问权限列表? - How can i find list of access which provided for my user account in SQL Server? 连接到excel中的SQL服务器会导致Active Directory帐户锁定吗? - Can connecting to the SQL Server in excel cause Active directory account locks? 如何将当前的IIS / Active Directory用户输入SQL? - How can I entrer the current IIS/Active Directory user into SQL? 测试Active Directory帐户的SQL Server连接 - Test SQL Server connection for an Active Directory account SQL服务器本地账号密码轮换如何影响活跃用户 - How SQL Server local account password rotation impact active user 如何在JBoss中配置SQL Server数据源以使用特定的Active Directory用户进行连接? - How do I configure a SQL Server datasource in JBoss to connect using a specific Active Directory user? 如何在 SQL 服务器中添加 Active Directory 用户组作为登录名 - How to add Active Directory user group as login in SQL Server SQL Server查询通知-如果我们不能将数据库SA角色授予运行网站的用户,则需要Active Directory中的权限? - SQL Server Query Notifications - Needed permissions in Active Directory if we can't grant the database SA role to the user running the web site?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM