2

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: enter image description here

4

1 回答 1

0

您当前请求的方案是不可能的,也不支持。到目前为止,唯一受支持的选项(并且仍处于 PREVIEW 中)是Azure 中的Active Directory REPLIC A。这意味着您必须拥有本地 AD 并将 Azure 用作副本。

为了复制副本,您必须配置Azure 虚拟网络以在本地计算机和 Windows Azure 虚拟网络之间建立 VPN。

我的猜测和猜测

可能的原因之一(我的猜测)是当前在 Windows Azure 虚拟网络中,尽管您自己定义了子网,但所有 VM都必须具有 DHCP 分配的 IP 地址。而主域控制器必须具有静态 IP 地址。

更新

如果您只想使用中所述的 LDAP 功能,LDAP://MyVMachine.testenv.local/则必须在 Windows Server Firewll 和 Windows Azure 虚拟机输入端点中打开 LDAP 端口(可从新门户配置,当您选择 VM 时,会出现“端点”菜单项在上面)。对于 SSL ,它应该是(默认)端口 389 或 636 上的 TCP 协议。并且您还必须安装服务器的 LDAP 功能并对其进行配置。但这些是更多的 AD/LDAP 细节,如果你不知道更好地询问serverfault

于 2012-10-26T18:42:44.037 回答