Access denied issue in Active directory Ldap

alap soni 1 Reputation point
2022-04-08T07:43:24.717+00:00

Hello,

I am creating a user in an active directory with lap connection (c#) from server 1 OU to another server OU with User (Domain user) having permission to create / set password , created through delegate wizard.
e.g.
PrincipalContext newContext = new PrincipalContext(ContextType.Domain, "LdapPath:389", oupath, ContextOptions.SimpleBind, username, password);

UserPrincipal newUserPricipal = new UserPrincipal(newContext, Convert.ToString(result.Properties["SAMAccountName"][0]), "somerandompassword", true);
newUserPricipal.Save();

User details with all properties get synced but set password throws Access denied exception.

I cannot make user administrator or domain admin as per policy. This worked with windows server 2012 r2. But not in windows server 2016. Why?

Windows for business Windows Server User experience Other
Developer technologies C#
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Limitless Technology 39,916 Reputation points
    2022-04-14T08:15:25.287+00:00

    Hi there,

    The specific privileges required by the user to connect to LDAP are "Bind" and "Read" which the user can obtain by being a member of the Active Directory's built-in administrators group. Try the same method with an Admin user and see if that sorts the issue.

    The other possible reason might be the credentials provided to access the Active Directory or LDAP tree might have included an expired password. To verify the account credentials, log on to the Domain Controller or LDAP server using the Remote Desktop Protocol (RDP) and verify your credentials.


    --If the reply is helpful, please Upvote and Accept it as an answer–


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.