Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

In our current system, we query the LDAP using SQL Server 2008R2 but are moving to SQL Server 2012 where we have hit a snag. According to http://msdn.microsoft.com/en-us/library/cc707782.aspx one of the discontinued features of SQL Server 2012 is the AD helper service.

Does anyone know of a way to query the AD from SQL Server 2012?

share|improve this question
    
You could e.g. use a web service and call it using SQL-CLR from your SQL Server code –  marc_s Jun 13 '13 at 15:30
1  
I would think this is possible using SQLCLR directly, but I haven't tried it. That's where I would start, though. –  Jon Seigel Jun 13 '13 at 16:35
add comment

1 Answer

You should still be able to create a linked server to an LDAP database and query the LDAP database directly via the linked server.

There's information here on setting up the linked server.

To test I setup the linked server based on this post. Then I ran the following code and got back a recordset with various information in it (where bacon.lab is my AD domain).

SELECT * FROM OpenQuery ( 
  ADSI,  
  'SELECT displayName, telephoneNumber, mail, mobile, facsimileTelephoneNumber 
  FROM ''LDAP://bacon.lab''
  WHERE objectClass =  ''User'' 
  ') AS tblADSI
ORDER BY displayname
share|improve this answer
    
The problem isn't setting up a linked server but querying the LDAP which uses the Active Directory Helper Service –  user1207758 Jun 13 '13 at 19:15
    
Setting up a linked server to AD on SQL 2012 I'm able to query active directory without issue via the linked server. The AD Helper service is used when SQL Server needs to create objects in AD, not when it needs to query AD. –  mrdenny Jun 13 '13 at 23:19
1  
@user1207758: Those procedures have been removed in 2012. You will have to rewrite your code. –  Jon Seigel Jun 13 '13 at 23:22
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.