I need to add new entries in a Active Directory on Windows Server 2012 that I have in a Virtual Machine.
I'm on a Symfony 4 project using the Ldap Component bundle : https://symfony.com/doc/current/components/ldap.html
According to this documentation, I applied the following code:
######################## Form Add ######################## $entry = new Entry('CN=' . $infos->getCn() . ',' . $infos->getCheminAD(), ['middleName' => [$infos->getService()],'info' => [$infos->getTypeEquipement()],'initials' => [$infos->getNoeudDestination()],'sAMAccountName' => [$infos->getSAMAccountName()],'cn' => [$infos->getCn()],'sn' => [$infos->getNom()],'givenName' => [$infos->getPrenom()],'displayName' => [$infos->getNomAffiche()],'employeeNumber' => [$infos->getNumeroBadge()],'streetAddress' => [$infos->getBatiment()],'postOfficeBox' => [$infos->getEtage()],'physicalDeliveryOfficeName' => [$infos->getBureau()],'objectClass' => ['inetOrgPerson'] ]); $load = $ldap->save($management->getNomSite(), $entry);###################################### Methode on class Service ###################################### public function save($locate, $entry) { $connexion = $this->getConnexionLDAP(strtolower($locate)); $ldap = Ldap::create('ext_ldap', array('host' => $connexion['ip'], )); $ldap->bind($connexion['login'], $connexion['password']); $entryManager = $ldap->getEntryManager(); $add = $entryManager->add($entry); return $add; }
I'm getting the following error :
Could not add entry "CN=1,OU=FONCTIONNEL,OU=Users_visible,OU=Users,OU=Telephony,OU=Service,DC=ff,DC=STEP,DC=entreprise,DC=fr": Server is unwilling to perform.
I completely discover how Active Directory works, I read a lot of things on google to find a solution. But I'm completely lost, I don't understand what I'm reading (context out of Ldap Component of Symfony) and despite my attempts to try to apply cross solutions, I'm still in the incomprehension since 15 days.