如何让我的SQL Server访问AD组?

时间:2021-01-22 22:32:53

I have a group in AD that logins to windows and what I want to do is to grant the same AD group access to SQL Server using the AD credentials.

我在AD中有一个登录到Windows的组,我想要做的是使用AD凭据授予相同的AD组访问SQL Server的权限。

My SQL Server is setup to use mixed mode (windows and SQL Server logins).

我的SQL Server设置为使用混合模式(Windows和SQL Server登录)。

So lets say my AD group name is : MyCompanyGroup

所以假设我的AD组名是:MyCompanyGroup

I want to grant access to that group to be able to connect to SQL Server.

我想授予该组的访问权限,以便能够连接到SQL Server。

Can anybody guide me how to do this?

任何人都可以指导我如何做到这一点?

Thanks.

1 个解决方案

#1


2  

If you have 100+ SQL Server instances, you have to run this script 100+ times.

如果您有100多个SQL Server实例,则必须运行此脚本100次以上。

Also: you will need to create specific users for that login in those databases that the login should have access to.

另外:您需要在登录应该有权访问的那些数据库中为该登录创建特定用户。

Basically use something like:

基本上使用类似的东西:

USE (database name)
CREATE USER (username) FOR LOGIN (loginname)

See the MSDN How-To: Create a Database User for detailed info.

有关详细信息,请参阅MSDN操作方法:创建数据库用户。

But everything can be scripted. And with a decent tool like Red-Gate SQL MultiScript, you can even have it executed on all your 100+ instances automagically.

但一切都可以编写脚本。使用像Red-Gate SQL MultiScript这样的不错工具,您甚至可以在所有100多个实例上自动执行它。

#1


2  

If you have 100+ SQL Server instances, you have to run this script 100+ times.

如果您有100多个SQL Server实例,则必须运行此脚本100次以上。

Also: you will need to create specific users for that login in those databases that the login should have access to.

另外:您需要在登录应该有权访问的那些数据库中为该登录创建特定用户。

Basically use something like:

基本上使用类似的东西:

USE (database name)
CREATE USER (username) FOR LOGIN (loginname)

See the MSDN How-To: Create a Database User for detailed info.

有关详细信息,请参阅MSDN操作方法:创建数据库用户。

But everything can be scripted. And with a decent tool like Red-Gate SQL MultiScript, you can even have it executed on all your 100+ instances automagically.

但一切都可以编写脚本。使用像Red-Gate SQL MultiScript这样的不错工具,您甚至可以在所有100多个实例上自动执行它。