views:

244

answers:

2

I received a client application, using SQL Server 2005, which contains many views with joins to their active directory. They do this to secure what people can see in the database. I need to be able to run these view from my remote development environment and I am looking for suggestion on how to do this.

I cannot duplicate their AD server, i.e. run it in a VM.
I guess I could re-write the views removing the joins to AD, but that seems to be a waist of time.

I read about Active Directory Lightweight Directory Services in this SO question, could that achieve an environment for me to query against?

I am not apposed to setting up a VM with Active Directory services, but it could lead to a lot of extra configuration time, where a simpler LDAP server may work just as well (shrug).

Here is an example of a query used for accessing the AD (Most of the fields aren't used but that's a job for another day):

...   
FROM    OPENQUERY(ADSI, 
   'SELECT  Sn, givenName, userPrincipalName, Name, company, physicalDeliveryOfficeName,
    department, streetAddress, L, St, postalCode, Co, Mail, telephoneNumber,
    facsimileTelephoneNumber, manager, samaccountname, extensionattribute1    
    FROM ''LDAP://OU=EPPPPUsers, DC=EPPPP, DC=COM''
    WHERE objectClass=''user'' OR objectClass=''contact''') AS rs1    
LEFT OUTER JOIN     
  (SELECT  'EPPPP\' + SUBSTRING(userPrincipalName, 0, CHARINDEX('@', serPrincipalName)) AS UserName, CN    
FROM     
  OPENQUERY(ADSI, 'SELECT userPrincipalName,    CN    
  FROM ''LDAP://OU=EPPPPUsers, DC=EPPPP, DC=COM''') AS Rowset_1) AS mUsr    
    ON mUsr.CN = LEFT(SUBSTRING(manager, CHARINDEX('=', manager) + 1, LEN(manager)), CHARINDEX(',', SUBSTRING(manager, CHARINDEX('=', manager) + 1, LEN(manager))) - 1)
+4  A: 

Can you replicate the AD content that you need with ADAM? I've used it on XP, as well as 2003.

ericp
Looks promising, I will give it a go this weekend and report back. Thank you.
Brettski
+1 my thoughts exactly - mocking an entire AD is a big chunk of work! :-) But AD/AM (or AD LDS as it's called now) should be quite useful
marc_s
A: 

Seems like this would be best done by asking them to export the objects and values that are of interest to an LDIF file.

Then you could (hopefully easily) import the file into an ADAM instance.

-jim

jeemster