# Synchronize Active Directory Groups to Cloud Voice

Once Cloud Voice is connected to your Active Directory (AD), you can control exactly which AD groups become extension groups on the phone system. This page walks through defining that rule so only the groups you want are brought across.

## Before you start

Your Cloud Voice system must already be [integrated with Active Directory](/pbx/integrations/ad/integrate-cloud-voice-cloud-voice-with-active-directory/) over LDAP (Lightweight Directory Access Protocol, the standard way to query a directory service).

:::caution
Cloud Voice supports a maximum of 63 extension groups, so the number of AD groups you can synchronize is capped at that same limit.
:::

## Define the group synchronization rule

1. Sign in to the Cloud Voice management portal and open **Integrations > Collaboration**.
2. Find the **Group Synchronization** section and enable its switch.

   ![Group Synchronization toggle switched on in the Collaboration settings](/images/pbx/turn-on-group-sync.png)

3. Use the **Synchronize for** field to choose which AD groups are pulled into Cloud Voice.

   ![Synchronize for selector with the available scope options](/images/pbx/ad-group-sync-for.png)

   | Option | What it does |
   | --- | --- |
   | All Groups | Brings every AD group in the connected directory into Cloud Voice. |
   | Specific Group Type | Brings only the group type(s) you pick from the **Type** drop-down list. Choose **Security Group** to include all AD security groups, **Distribution Group** to include all AD distribution groups, or both. |
   | Groups Searched by Filter | Brings only the AD groups that match an LDAP filter. Enter the criteria in the **Search Filter for Group** field. For example, `(&(objectCategory=group)(cn=sales*))` matches every group whose name begins with "sales". |

   :::note
   If you later narrow the set of groups being synchronized, the **Auto delete the Extension Groups no longer in sync** option decides what happens to the extension groups that fall out of scope:

   ![Auto delete option for extension groups that are no longer synchronized](/images/pbx/auto-delete-unsync-extension-groups.png)

   - Selected: those extension groups are removed at the next synchronization.
   - Cleared: those extension groups stay in place and become fully managed within Cloud Voice.
   :::

4. Click **Save**.

   :::note
   The first time you save synchronization settings, Cloud Voice runs an initial synchronization right away. After that, changes take effect when you [start a synchronization manually](/pbx/integrations/ad/manually-perform-a-directory-synchronization/) or when the [scheduled synchronization](/pbx/integrations/ad/schedule-automatic-directory-synchronization/) next runs.
   :::

## What happens after synchronization

Your custom rule for AD groups is now in place. Each time synchronization runs, Cloud Voice performs LDAP queries against the directory using this rule and imports the matching groups along with any changes made in AD. Once it completes:

- The outcome is shown in the **Group Synchronization** section.

  ![Group Synchronization results after a completed sync](/images/pbx/group-sync-result.png)

- Extension groups that originate from AD are marked with a ![AD-synced group label](/images/pbx/logo.png) label and cannot be deleted in Cloud Voice.
- You cannot rename these groups or change their membership from Cloud Voice.

  :::note
  Names and members of AD-linked groups can only be edited in Active Directory. The changes reach Cloud Voice on the next synchronization.
  :::
