Closed markatdxb closed 5 months ago
I think this might be a side effect of the work done to pre-validate the member names at here and here. Both of these checks are run with @adParams
which contains the Server = '{{ domain_b }}'
value here so it's going to ask the wrong domain to lookup that user.
We might need some extra logic there to state if the value is in the DN format or use a custom -Server
parameter if the Netbios format is specified like the win_domain_group_membership
behaviour.
Similar issue might be at ad.computer module with managed by assignment ?
Seeing something similar for Foreign Security Principals. This happens when adding a user from Forest A to a group in Forest B (where a trust relationship exists between Forest A and Forest B).
I think the solution @jborean93 proposed for the intra-Forest issue (using custom -Server
parameter) will work for this scenario as well.
It took a while to get to but I've revamped the code to now include generic lookup behaviour for distinguishedName
backed attributes. The PR https://github.com/ansible-collections/microsoft.ad/pull/117 will allow members
and managed_by
to lookup the DN on a custom server using the following syntax:
- name: Add user to AD group
microsoft.ad.group:
identity: test_group
name: test_group
domain_server: domain_b
members:
add:
# Will lookup on default DC
- user1
# Will lookup on domain_b
- name: user2
server: domain_b
managed_by:
name: admin-user
server: domain_b
It also allows you to specify custom credentials for more than just the default server using the new domain_credentials
option.
SUMMARY
Process fails when trying to add the user from Domain A to AD group in Domain B community.windows.win_domain_group_membership module has an option under the members attribute: If the member object is part of another domain in a multi-domain forest, you must add the domain and “\” in front of the name. this concept doesnt work in microsoft.ad.group module. i have also tested to use DN name but no luck.
ISSUE TYPE
COMPONENT NAME
microsoft.ad.group
ANSIBLE VERSION
COLLECTION VERSION
CONFIGURATION
OS / ENVIRONMENT
STEPS TO REPRODUCE
EXPECTED RESULTS
add user from domain A into group in domain B
ACTUAL RESULTS
message saying that it cant find the object