Closed AllRWeak closed 2 months ago
@AllRWeak Please try adding this user account to the group manually using Set-ADGroup
to see if the issue occurs in this case as well.
Yes using this command manually works: Set-ADGroup -Identity Administrators -Add @{member="CN=Domain_Administrators,OU=Groups,DC=example,DC=com"}
Thanks for the bug report, it looks like v1.6.0 which unified the DN attribute based value lookups to some common code changed how the members
option for the group
module worked. In the old code it was using the -Add
and -Remove
parameters to add/remove the members required. https://github.com/ansible-collections/microsoft.ad/blob/0de35154f82f6bf8092845df8a48e4a35ea91f2d/plugins/modules/group.ps1#L148-L159
In the latest version with the unified code it uses the -Replace
parameter to just set it once but it seems like for the "builtin" groups the -Replace
parameter cannot be used. I've got some local code which reverts the logic for this specific option to using -Add
/-Remove
but I'll need to write some tests before pushing it to make sure this doesn't regress in the future.
SUMMARY
Starting from version 1.6.0
microsoft.ad.group
module errors when trying to add members to a built-in group like Administrators. The same code worked with the previous version of the collection.ISSUE TYPE
COMPONENT NAME
microsoft.ad.group
ANSIBLE VERSION
COLLECTION VERSION
OS / ENVIRONMENT
Docker container based on
python:3.11.9-slim-bookworm
STEPS TO REPRODUCE
The error occurs when trying to include the following task on a domain controller (the Domain_Administrators is already pre-created):
EXPECTED RESULTS
Add the
Domain_Administrators
to the built-inAdministrators
group.ACTUAL RESULTS
The command errors with the following message: