OBLYTECH Logo
OBLYTECH Logo

Use the Active Directory activity pack in Orchestration workflows

Use the Active Directory activity pack in Orchestration workflows to create, update, remove, and manage Windows AD users, groups, and computers. Configure a PowerShell-capable MID Server and Windows orchestration credentials, supply the domain controller IP address, then combine AD activities with queries, conditional branches, and explicit failure handling for the intended account operation.

Prepare the Active Directory activity pack for Orchestration workflows

Start with the execution path before drawing the account workflow. Your instance needs access to a MID Server configured to run PowerShell. Request activation of the Orchestration – Active Directory plugin for the custom activities. Check the activity set and configuration on your instance and release before building.

Supply the domain controller as an IP address. When your input is a hostname, place Resolve DNS Name before the AD activity and pass its resolved IP forward. Treat name resolution as a separate dependency: an account operation cannot demonstrate correct behavior if it receives the wrong controller destination.

Create a Windows type orchestration credential record. AD activities do not take their username and password from the LDAP Server configuration, even when LDAP uses a MID Server. Check the orchestration credential separately from the account used for directory imports. A successful import therefore does not establish that an orchestration update can authenticate.

AD Orchestration activities use port 389 for LDAP access. If Oracle Virtual Directory acts as a proxy, configure pass-through on port 389. Include that route in connectivity checks alongside the MID Server and domain controller. For the surrounding import configuration, see LDAP integration with ServiceNow.

Choose the activity that matches the directory change

Define the intended AD change before selecting an activity. Creating an object, disabling a user, and removing group membership are different actions with different consequences. Use a test identity and specify the expected directory state after each operation so the workflow can be assessed against an observable result.

  • Create AD Object and Remove AD Object handle object creation and deletion. Update AD Object replaces values that already exist on an object and cannot add a new value such as a group membership; use Add User to Group for that change.
  • Disable AD User Account and Enable AD User Account change whether a Windows AD user account is active.
  • Add User to Group and Remove User from Group change a user’s group membership.
  • Is AD Account Locked and Unlock AD Account support account lock checks and unlocking.
  • Change AD User Password and Reset AD User Password provide password operations.
  • Query AD retrieves entries using an LDAP search filter and exposes the results as a JSON string in the data bus.

The pack can manage an account that was created outside Orchestration. You do not need to recreate an existing directory account to bring it into a workflow. Identify it consistently, query for it, and apply the operation that matches the request.

For onboarding, decide which attributes come from the ServiceNow user record and which belong to a separate directory policy. For offboarding, make the choice between disabling, removing memberships, and deleting explicit. Do not treat these operations as interchangeable cleanup steps. A broader Active Directory integration guide helps place the workflow within the integration design.

Build a user synchronization workflow with explicit inputs

A focused starting point is a workflow that receives a ServiceNow User [sys_user] record and creates or updates the corresponding AD account. Establish which system owns the attributes you intend to write. Otherwise, an automated update can replace a directory value that another process is meant to maintain.

This procedure uses the classic Workflow Editor. ServiceNow recommends Workflow Studio for new process automation, and the classic editor should be opened in the Core UI rather than the Next Experience UI.

  1. Navigate to All > Workflow > Workflow Editor. On the Workflows tab in the palette, click New Workflow. Fill in the Name and Table fields, then click Submit.
  2. Open the Workflow Activities menu and select Edit Inputs. In the Edit Inputs dialog, select New, then set the Column name to u_user. Confirm the field type and reference options on your release before saving. Select Submit.
  3. In the Custom tab, expand Custom Activities > Active Directory. Add Update AD Object between Begin and End to configure the initial update operation.
  4. Set Domain controller to the intended controller IP, Type to User, and Object name to the identity you intend to update. Configure Object data with the attributes and values you own.

When ServiceNow user_name matches AD sAMAccountName, the Object name expression can be ${workflow.inputs.u_user.user_name}. Treat that equality as a mapping assumption to verify, rather than a property of every deployment. Check a representative existing account before allowing updates to a larger set of users.

An Object data value such as {“title”:”QA”} demonstrates a single attribute change. Replace the example with a deliberate mapping for your process. Begin with a small change whose before and after values are easy to inspect. An update against a missing account fails, which is why account discovery must precede the production update path.

Query first and branch between creation and update

Add Query AD before the write activities. Use the same controller destination as the subsequent operations. In Search filter, an identity mapping based on the ServiceNow username can use (samaccountname=${workflow.inputs.u_user.user_name}). Validate the input record and identity mapping before relying on the query to select an account.

Properties accepts a comma-separated list of attributes to return. For a limited inspection, request givenName, SN, and title. Leaving Properties blank returns all properties. Choose the returned attributes to support your checks and downstream work, rather than carrying an unnecessarily broad result through the workflow.

Query AD stores its result as a JSON string in the output variable. Before relying on it for the create-or-update decision, run a query for an account that does not exist and record exactly what the output contains on your release. A failed query is a different condition and should not lead directly into account creation. Keep the query’s Failure route separate from the no-match decision.

Add an If activity from the Core palette tab. Select Advanced to expose Script. Decode the query result and set answer to yes when the resulting array contains an entry, or no when it is empty. Connect Yes to Update AD Object and No to Create AD Object.

The data bus reference must identify your Query AD activity. An order number copied from another workflow can point to a different output after activities are added. Inspect the data bus in your workflow and verify that the decision receives the intended JSON result before testing either write branch.

In Create AD Object, supply the controller, Object name, OU, and Object data. Create AD Object fails if an object with matching input variables already exists, so route that failure to the update path rather than treating it as a generic error. Use the intended organizational unit and map the initial attributes, such as givenName and SN, from the input record. Connect successful creation to the update operation if additional attributes belong there. Test the existing-account branch and new-account branch independently.

For help planning this work, see ServiceNow implementation.

Check failure paths and validate the directory result

AD activities pass through errors returned by Active Directory. Point to the failed activity on the workflow canvas or open the Workflow Log tab in the Workflow Context record. Use the returned message to distinguish destination, authentication, object identification, and attribute problems before changing the workflow.

Define an alternate action for failed writes, such as a notification or review step appropriate to the process. Ending the workflow after an error may suit a small demonstration, but it leaves an operational request without a clear resolution. Record enough context for the reviewer to identify the requested change and the activity that failed.

Use a test checklist that includes an existing account, a missing account, a query failure, and a write failure. Inspect the AD object after execution, including its location and changed attributes. Confirm that an unsuccessful query does not create an account and that a creation failure does not proceed as though the account exists.

If the operation supports a security response, align its failure handling with the surrounding security incident response orchestration workflow. The directory action should have a clear outcome that the larger process can interpret.

Design choices that affect the AD synchronization workflow

Does the synchronization example require LDAP?

The AD activities query the directory over LDAP on port 389, but they take their credentials from a Windows type orchestration credential record, not from an LDAP Server record. An LDAP Server configuration does not supply those credentials. An LDAP configuration simplifies the example’s user-to-directory relationship. Without it, provide the controller destination and identity mapping through a deliberate input or lookup design.

Should an older workflow be rebuilt with legacy AD activities?

Use the custom AD activities for new workflows. Existing workflows built with earlier legacy activities have historical upgrade compatibility, which does not make those older activities the starting point for a new design.

Can the domain controller address come from the CMDB?

Yes. The Domain controller field takes an IP address, so the value can come from a workflow input or from a script you write. The documentation does not describe a CMDB lookup for it, so test that path before relying on it. Choose a method whose ownership and maintenance fit the environment.

What should happen if a query returns several matching accounts?

As a design safeguard, route the request for investigation before making a write. The simple existence decision checks whether results are present; it does not establish that the chosen identity uniquely represents the intended person.