amazon-ssm-agent icon indicating copy to clipboard operation
amazon-ssm-agent copied to clipboard

ADConnector. Error joining a workstation (EC2 instance) to domain. EntityAlreadyExists

Open adam-moghal opened this issue 8 years ago • 2 comments

I have an Active Directory server and I am able to join workstations (EC2 instances) I spin up to my AD domain on first try using the ADConnector Directory Service.
Now the problem i am having is when I recreate the same workstation with the same name, I am getting EntityAlreadyExistsException error. I am using SSM documents aws:domainjoin Config to join it to the domain. Since the computer object exists in AD from the first time I create a workstations, if I recreate it, the AmazonSSMAgent logs complain saying it already exists (in the domain). Is there a way to force the workstation to join the domain if it already exists or is this a limitation of the ADConnector Also I have followed the pre-requisites for creating the ADConnector; setting up the ADConnector user and group and granting it the minimum permissions.I have also tried by giving it Full control and it still does not work

adam-moghal avatar Aug 17 '18 12:08 adam-moghal

That's a limit of Active Directory, not ADConnector. You can't join a domain if your computer name already exists on that domain. You need to delete the computer account on the domain first.

Alternatively, if you want to reuse a computer account you can use djoin.exe on an admin machine to reset the computer password and store it in a file. You can then copy that file to the new workstation and use djoin.exe, specifying that file, and that will work. That is, however, far more complex than just deleting the computer account.

thedevopsmachine avatar Aug 17 '18 15:08 thedevopsmachine

Thank you for creating the issue. As Justin mentioned this is a limitation of Active Directory: The alias must be unique amongst all aliases in AWS. This operation throws an EntityAlreadyExistsException error if the alias already exists. https://docs.aws.amazon.com/directoryservice/latest/devguide/API_CreateAlias.html

nehalaws avatar Aug 17 '18 18:08 nehalaws