Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Querying Active Directory with SQL 2005

Author  Topic 

ianbhenderson73
Starting Member

2 Posts

Posted - 2013-02-21 : 13:32:12
Good evening

I'm a SQL Server DBA/Developer of about 12 years' standing, but I've come across a need to do something new and I'm hoping that someone out there will be able to help me.

We run some web-based software which is back-ended with a series of SQL databases, on a 2005 Standard installation. At the moment, if I need to grant access to that system to a user or users, I need to do so manually.

The backbone of the system is a users table which contains as one of its columns the login name for every user that needs access to the system (minus the domain name). Rather than me having to manually create all of the users, I'd like to be able to query an Active Directory group and use the results from that query to automatically populate the users table. However, I'm really struggling to find the relevant SQL to make that possible. I've found a number of resources online that claim to provide the code but I can't make it work.

Can anyone provide me with a simple (and if necessary step-by-step) instruction on setting this up?

Thanks in advance.

Ian Henderson
BI Developer

James K
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2013-02-21 : 14:28:45
The links on this page are pretty good - if you have not already visited it, please try that: http://support.microsoft.com/kb/299410

If you don't have to have the list of users in the database for other purposes, the ideal way to do this in my mind would be to create an AD group of which all the authorized users are members of, add the AD group as a login and user on the database, and grant the required privileges to that login/user. From then on, you would simply maintain the users in Active Directory; you would not need to touch the database.

But it sounds like that is not your situation - do you need the list of users in a table in the database for purposes other than granting them access to the database/objects?
Go to Top of Page

sanjnep
Posting Yak Master

191 Posts

Posted - 2013-02-21 : 15:50:14
May be this will help you....

http://sql.dzone.com/news/querying-active-directory-thro

Go to Top of Page
   

- Advertisement -