Monday, March 19, 2012

Active Directory and Stored Procedures

I have a need to access the active directory from a stored

procedure. I am certain that CLR is the answer but I am having a

hard time finding and example and I am a true newbie to AD and CLR.

Has anyone ever attempted to do this? I would love to see an example in VB if possible.It's certainly feasible to use SQLCLR to access AD. However, depending on how you plan to use the data coming from AD, it's not necessarily the most convenient approach. Instead of connecting to AD from managed code, you might want to consider linking to your AD store from
within SQL Server (see
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/adsi/adsi/joining_heterogeneous_data.asp,
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/adsi/adsi/creating_and_executing_a_view.asp,
and http://msdn.microsoft.com/library/default.asp?url=/library/en-us/adsi/adsi/creating_a_heterogeneous_join_between_sql_server_and_active_directory.asp for details). This would allow you to create joins directly to AD-sourced views, which may better suit your use of AD data from a stored procedure.|||Thank you, I had seen the first link and had started working with it.

I now have to find a way to convert the SID from a byte array so I can

store it in my application. I am only storing the SID and will

make "round trips" to the AD for all user information.

I appreciate your help.

Rick

No comments:

Post a Comment