我正在尝试将我们的本地 AD 与 Azure 函数应用程序集成。我需要能够获取用户并更新他们。
我们拥有 Azure AD 和本地 AD,它们通过 Azure AD Connect 同步,而 Azure AD Connect 仅以一种方式同步(从 AD 到 AAD)。因此,我想更新本地 AD 中的用户,这将同步到 Azure AD。 为此,我使用 System.DirectoryServices.AccountManagement,它在我的本地计算机上运行良好。 但是,它在我的 Azure 应用程序中不起作用。
我们已经建立了与 AD 的混合连接以拥有网关,但我们无法使其正常工作。我们还创建了一个具有该域读取权限的用户。
代码:
public Principal GetPrincipalUser(string employeeID)
{
var context = new PrincipalContext(ContextType.Domain, "mydomain:636", "username", "password");
UserPrincipal qbeUser = new UserPrincipal(context);
qbeUser.Enabled = true;
qbeUser.EmployeeId = employeeID;
using (var searcher = new PrincipalSearcher(qbeUser))
{
PrincipalSearchResult<Principal> result = searcher.FindAll();
return result.FirstOrDefault();
}
}
我们不断收到的异常是:“无法联系服务器。LDAP 服务器不可用。”
关于如何连接有什么建议吗?
谢谢!
最佳答案
Azure 混合连接不支持 LDAP,因为它可能需要 UDP。
https://learn.microsoft.com/en-us/azure/app-service/app-service-hybrid-connections
关于azure - 如何从 Azure 应用程序连接到本地 AD,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67407755/