How can i access Active directory on remote machine. I have created a win server 2008 R2 with AD installed in Azure. Hostname: MyVMachine, DNS: myapp.cloudapp.net. I can access the machine using remote desktop connection from my laptop.
I want to authenticate users against that AD. Should i use ContextType.Domain or ContextType.Machine and what about LDAP, how to constrauct it in order to contact that AD? This code is in a WCF service application in my laptop. The following is not working:
using (PrincipalContext pc = new PrincipalContext(ContextType.Domain, "LDAP://MyVMachine.testenv.local/ou=Users,dc=testenv,dc=local"))
{
// validate the credentials
bool b = pc.ValidateCredentials("Administrator", "password");
return true;
}
i want here to authenticaate the user Administrator whiich i see exsists in Users node in testenv.local node i AD machine.
with this code i am getting "The server could not be contacted." with principalServerDownExceptioan.
I need help please.
Thank you all
My AD Machine in Azure: