Not able to add user to AD group based on selected environment
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-15-2026 07:55 AM - edited 10-15-2026 08:10 AM
I have a requirement in which I have three variables on the catalog item: requested for, which instance, and which role (AD group).
The requirement is to add user to the ad group in Prod or Non-Prod environment based on the selection in which instance variable.
I had configured a flow in flow designer and used call a workflow action where I was using the out of the box active directory workflow which was giving error in production and was not able to resolve domain properly.
For the Prod and Non-Prod environment selection, I am trying to use the domain controller. There is no action or flow or subflow is available at the moment in my instance which I can use for this issue.
If anyone knows an OOB solution please let me know and if there is nothing OOB then let me know what's the best possible custom approach to do this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2026 04:03 AM
Hi @FahadM079759872 ,
If my response helped, please mark it as the accepted solution so others can benefit as well.
Supriya Waghmode
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
There is an out-of-the-box action, but the Microsoft Active Directory spoke has no built-in way to choose between two environments. That part needs a small customization. The spoke needs an IntegrationHub subscription, and it includes an Add User To Group action. The documentation says the domain controller is set on the spoke’s connection. A community post notes the spoke expects the MID Server’s domain and the target domain to be the same or have a trust. That matches the domain resolution error you are seeing in production.
The practical design is:
- Have a MID Server that can reach each environment’s domain controller. If the Prod and Non-Prod domains have a trust, one MID Server may be enough, but check this with your AD team.
- Create a separate Windows credential under Connections & Credentials for each environment, using an account allowed to add group members. Community answers say the spoke otherwise falls back to the MID Server service account, which can cause authentication failures.
- In the flow, branch on the which instance variable. Each branch calls the Add User To Group action against that environment’s connection and domain controller.
- If the spoke action cannot take the domain controller as an input, a Community article describes a custom approach. It adds a custom function and an input for the user’s domain controller to the spoke’s ActiveDirectoryMain.psm1 PowerShell module. Make a copy in your own scope rather than editing the out-of-box module.
- Test with a Non-Prod group first, and have the AD team confirm the service account’s permissions in each environment.
Custom PowerShell on the MID Server is the fallback if the spoke approach doesn’t work. The same rules apply: one credential per environment and a test run against Non-Prod first.
Sources: