Finding the Target Active Directory OU of an Okta Assignment Group via API
Last Updated:
Overview
When a group is assigned to an Active Directory (AD) integration in Okta for user provisioning, the target organizational unit (OU) is stored in the group's profile and can be accessed via the API. A GET request to the Okta API retrieves the organizationalUnit attribute, which contains the distinguished name (DN) of the targeted AD OU.
Applies To
- Okta Identity Engine (OIE)
- Okta Classic Engine
- Active Directory Integration
- Group Assignment
- User Provisioning
Solution
How Is the Target AD OU Retrieved for an Okta Assignment Group?
Make a GET request to the Okta API targeting the Active Directory application instance and the specific Okta group ID to retrieve the target AD OU.
- Make the following
GETrequest, replacing the placeholders with the appropriate values:
GET https://{yourOktaDomain}/api/v1/apps/{adAppId}/groups/{oktaGroupId}
{yourOktaDomain}: The Okta domain for the organization.{adAppId}: The unique ID of the Active Directory integration. Locate this ID by listing apps viaGET /api/v1/appsor by checking the URL string when viewing the directory in the Okta Admin Console.{oktaGroupId}: The ID of the Okta group being checked.
- If the group is assigned to the AD integration for user provisioning, the response JSON contains a
profileobject. Locate theorganizationalUnitattribute inside this object — it stores the distinguished name (DN) of the targeted AD OU.
