I got a client application using SQL Server 2005 that contains many views with joins to their active directory. They do this to ensure that people can see in the database. I need to be able to run this view from my remote development environment, and I am looking for suggestions on how to do this.
I cannot duplicate their AD server, i.e. run it in a virtual machine.
I think I could rewrite the opinions that remove joins in AD, but that seems like a waist of time.
I read Active Directory Lightweight Directory Services in this SO question , Can this create an environment for the query?
I am not connected to setting up a virtual private network using Active Directory, but this can lead to a lot of additional settings when a simpler LDAP server can work just as well (shrug).
Here is an example of a request used to access AD (most fields are not used, but this task is for one more 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)