# Synchronize Active Directory Organizational Units to Cloud Voice

You control which Active Directory (AD) organizational units flow into Cloud Voice, and whether each one lands as a Cloud Voice organization or as an extension group. This page walks through defining that rule.

## How much can be synced

The volume of AD organizational units Cloud Voice can absorb is capped by how many organizations and extension groups your account is allowed to create. Those ceilings scale with your extension count:

| Maximum number of extensions (N) | N ≤ 50 | 50 ≤ N ≤ 200 | N > 200 |
| --- | --- | --- | --- |
| Maximum organizations | 50 | 200 | 500 |
| Maximum extension groups | 63 | 63 | 63 |

:::caution
These ceilings are hard caps. If the AD organizational units in your sync scope would exceed the limit for your extension count, the units beyond the cap cannot be created in Cloud Voice. Confirm your extension count and keep the scope within range so nothing is silently left out.
:::

## Before you begin

Make sure you have already [connected Cloud Voice to Active Directory](/pbx/integrations/ad/integrate-cloud-voice-cloud-voice-with-active-directory/).

## Configure the rule

1. Sign in to the Cloud Voice management portal and open **Integrations > Collaboration**.
2. Find the **Organizational Unit Synchronization** section and toggle the switch on.

   ![Organizational Unit Synchronization toggle switched on](/images/pbx/turn-on-ou-sync.png)
3. Choose one of the two approaches below and complete its settings.

   **Mirror organizational units**

   Copy the organizational units straight from Active Directory, preserving their nested hierarchy.

   a. Set **Synchronization Method** to **Organizational Units(OU)**.

      ![Synchronization Method set to Organizational Units](/images/pbx/sync-ou.png)

   b. Use the **Synchronize for** drop-down list to define which AD organizational units get pulled in.

      ![Synchronize for drop-down listing the scope options](/images/pbx/group-sync-for.png)

      | Option | What it does |
      | --- | --- |
      | All Organizational Units | Brings in every organizational unit in the connected directory. |
      | Specific Organizational Unit and Sub-OU | Brings in the organizational unit(s) you pick, along with their sub-OUs. Choose them from the **Organizational Unit** drop-down list. |
      | Organizational Units Searched by Filter | Brings in only the organizational units that match a filter you supply. Enter an LDAP search filter in the **Search Filter for Organizational Unit** field. For example, `(&(objectCategory=organizationalUnit)(ou=sales*))` finds units whose name begins with "sales". |

      :::caution
      If you later narrow the set of AD organizational units in scope, the **Auto delete the Organizations/Extension Groups no longer in sync** option decides what happens to the organizations or extension groups that fall out of scope. Selecting it is destructive, so leave it cleared if you are not sure.

      ![Auto delete option for organizations and extension groups no longer in sync](/images/pbx/auto-delete-unsync-ous.png)

      - Selected: they are deleted on the next synchronization.
      - Cleared: they stay and become fully managed by Cloud Voice.
      :::

   c. In the **Synchronize to** field, pick the type of object the organizational units become.

      ![Synchronize to field for choosing the target object type](/images/pbx/ou-sync-for.png)

      | Option | What it does |
      | --- | --- |
      | Organization | Maps the AD organizational units and their sub-OUs to Cloud Voice organizations. Set a name in the **Company Name** field, and use **Parent Organization** to place the synced units under an existing organization. |
      | Extension Group | Maps only the lowest-level organizational units to Cloud Voice extension groups. |

   **Synchronize based on a user object property**

   Group organizational units by the value of a chosen user attribute instead of the directory tree.

   :::note
   This method produces a flat structure. Say each user carries a **department** attribute holding values such as **Sales** and **Support**. Entering `department` as the property makes Cloud Voice create two extension groups, or two departments beneath the parent organization, named **Sales** and **Support**.
   :::

   ![Read Specific Property Value method with a property name entered](/images/pbx/ou-read-property.png)

   a. Set **Synchronization Method** to **Read Specific Property Value**.

   b. Type the attribute name into the **Property Name** field.

   c. In the **Synchronize to** field, pick the type of object the organizational units become.

      ![Synchronize to field for choosing the target object type](/images/pbx/ou-sync-for.png)

      | Option | What it does |
      | --- | --- |
      | Organization | Maps the AD organizational units and their sub-OUs to Cloud Voice organizations. Set a name in the **Company Name** field, and use **Parent Organization** to place the synced units under an existing organization. |
      | Extension Group | Maps only the lowest-level organizational units to Cloud Voice extension groups. |

   d. To have Cloud Voice clear out organizations or extension groups that leave the sync scope, select **Auto delete the Organizations/Extension Groups no longer in sync**.

      :::caution
      This stops unused organizations and extension groups from piling up as the sync scope shifts, but it is destructive: objects that fall out of scope are deleted on the next run. Leave it cleared to keep them instead.
      :::

      ![Auto delete option for organizations and extension groups no longer in sync](/images/pbx/auto-delete-unsync-ous.png)

      - Selected: they are deleted on the next synchronization.
      - Cleared: they stay and become fully managed by Cloud Voice.
4. Click **Save**.

   :::note
   - The very first time you save these settings, Cloud Voice runs the initial synchronization straight away.
   - After that, you can [run a synchronization manually](/pbx/integrations/ad/manually-perform-a-directory-synchronization/) or let the [scheduled synchronization](/pbx/integrations/ad/schedule-automatic-directory-synchronization/) handle it.
   :::

## Result

Your custom rule for AD organizational units is now in place. On each run, Cloud Voice issues LDAP queries against Active Directory according to the rule and pulls the matching organizational units, plus any updates, into your account. Once a synchronization finishes:

- The outcome appears in the **Organizational Unit Synchronization** section.

  ![Organizational Unit Synchronization section showing the sync result](/images/pbx/ou-sync-result.png)

- Any Cloud Voice organization or extension group tied to an AD organizational unit is flagged with a ![sync source label](/images/pbx/logo.png) label and cannot be deleted.
- You cannot edit those organizations by hand, nor rename the linked extension groups or change their membership.

  :::note
  Change this information in Active Directory instead; it reaches Cloud Voice on the next synchronization.
  :::
