We have the code:
PrincipalContext oPrincipalContext = new PrincipalContext(ContextType.Domain, "domain.com", "DC=domain,DC=com", "login", "password"); var user = UserPrincipal.FindByIdentity(oPrincipalContext, IdentityType.SamAccountName, userName); //устанавливаем новый пароль try { user.SetPassword(newPass); At the same time login is the most admin of all possible accounts in Active Directory. We start this business on localhost - everything is fine. We try to run the same procedure on a remote server, we get an error:
Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)
entry.Invoke("SetPassword", new object[] {newPass}); gives exactly the same result. At the same time, other Invoke and UserPrincipal methods work without problems, only SetPassword breaks. The web page is hosted on Azure Websites. What could be the problem? What is the difference to the application, where to work?