以下是代码:
PrincipalContext oPrincipalContext = new PrincipalContext(ContextType.Domain, "domain.com", "DC=domain,DC=com", "login", "password");
var user = UserPrincipal.FindByIdentity(oPrincipalContext, IdentityType.SamAccountName, userName);
user.SetPassword(newPass);
对于localhost部署,它运行良好,但是当我尝试在Azure Web App中运行此代码时,我收到以下错误
Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)
它出了什么问题?如何从Azure Web App重置AD中的用户密码?