Microsoft Entra ID
Provisioning

Scenario - Using directory extensions with group provisioning to Active Directory

In brief

The article now describes extending a group schema attribute and using it to filter groups provisioned to Active Directory. It replaces the previous combined users-and-groups examples with a group-focused scenario and setup instructions.

What Entra admins need to know

Administrators using this guide will follow the updated group provisioning workflow and assumptions; no required action is stated.

This editorial summary was generated by AI from the documentation changes. Verify important details in the full Microsoft Learn article.

Documentation change

The comparison below shows only the changed extract. Use the full-page view for complete context.

UseScenario - Using directory extensions whenwith group provisioning to Active Directory

A directory extension adds an attribute to theScenario: You have hundreds of groups in Microsoft Entra schema that Microsoft Entra ID owns. When youID. You want to provision from Microsoft Entra IDsome of these groups but not all back to Active Directory,Directory. You would like a quick filter that can be applied to groups without having to make a more complicated scoping filter.

:::image type="content" source="../media/common-scenarios/group-writeback-1.png" alt-text="Diagram of group writeback with cloud sync." lightbox="../media/common-scenarios/group-writeback-1.png":::

You can use the environment you can put that attribute to two uses: decide which objects are provisioned, or carry a value into an Active Directory attribute. Both uses work for users and for groups.

This article walks through one example of each. Select the Groups or Users tab in each step to follow the example you want. Your selection carries through the rest of the article.

TabExampleUse
GroupsWritebackEnabledProvision only the groups whose extension value is true.
UsersEmployeeCodeWrite the extension value into an Active Directory user attribute.

For background on directory extensions, see Directory extensions for provisioning Microsoft Entra ID to Active Directory. For the general mapping interface and expression syntax, see Configure provisioning to Active Directory.

Groups support attribute mapping as well. For a group whose Source of Authority is converted to Microsoft Entra ID, the GroupDN extension preserves the original organizational unit and common name. To create that extension, see Preserve a group's organizational unit and name. For the expression that reads it, see Preserve a group's original organizational unit.

Before you begin

Both examples need the same starting point:

  • A working environment that synchronizesis synchronizing users to Microsoft Entra ID.
  • A healthy provisioning agent connected to the target Active Directory domain.
  • A Microsoft Entra ID to Active Directory configuration, or permission to create one.

Each example then needs its own objects.

Groups

This example uses the following environment:

  • Four synchronized users:We have 4 users that are synchronized. Britta Simon, Lola Jacobson, Anna Ringdahl, and John Smith.
  • Three organizational unitsUnits have been created in Active Directory:Directory - Sales, Marketing, and Groups.Groups
  • The Britta Simon and Anna Ringdahl user accounts reside in the Sales OU.
  • The Lola Jacobson and John Smith user accounts reside in the Marketing OU.
  • The Groups OU is where our groups from Microsoft Entra ID are provisioned.

:::image type="content" source="

Create two groups in Microsoft Entra ID.
  • A target organizational unit, for example OU=test,DC=Contoso,DC=com.
  • A writable target Active Directory user attribute, such as extensionAttribute1.

  • You can use the environment you create in this article for testing or for getting more familiar with cloud sync.

    Install and connect Microsoft Graph PowerShell SDKID

    1. If not yet installed, follow Microsoft Graph PowerShell SDK documentation to install the main modules of Microsoft Graph PowerShell SDK: Microsoft.Graph.

    2. Open PowerShell with Administrative privileges.

    3. To set the execution policy, run (press [A] Yes to all when prompted):

      Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
      
    4. Connect to your tenant (be sure to accept on-behalf of when signing in):

      Connect-MgGraph -Scopes "Directory.ReadWrite.All", "Application.ReadWrite.All", "User.ReadWrite.All", "Group.ReadWrite.All"
      

    Create the CloudSyncCustomExtensionsApp application and service principal

    Both examples store their extension on the same application, so you only need to do this once.

    1. Get the Tenant ID:

      $tenantId

    1. Using the $tenantId variable from the previous step, check to see if the CloudSyncCustomExtensionsApp exists.

      $cloudSyncCustomExtApp = Get-MgApplication -Filter "identifierUris/any(uri:uri eq 'api://$tenantId/CloudSyncCustomExtensionsApp')"
      $cloudSyncCustomExtApp
      
    2. If a CloudSyncCustomExtensionsApp exists, skip to the next step. Otherwise,begin, create the new CloudSyncCustomExtensionsApp app:

      $cloudSyncCustomExtApp = New-MgApplication -DisplayName "CloudSyncCustomExtensionsApp" -IdentifierUris "api://$tenantId/CloudSyncCustomExtensionsApp"
      $cloudSyncCustomExtApp
      
    3. Check if the CloudSyncCustomExtensionsApp application has a service principal associated. If you just created a new app, skip to the next step.

      Get-MgServicePrincipal -Filter "AppId eq '$($cloudSyncCustomExtApp.AppId)'"
      
    4. If you just created a new app, or a service principal isn't returned, create a service principal for CloudSyncCustomExtensionsApp:

      New-MgServicePrincipal -AppId $cloudSyncCustomExtApp.AppId
      

    Prepare the objects to provision

    Groups

    Create two groups in Microsoft Entra ID. One group is Sales and the otherOther is Marketing.

    To create two groups, follow these steps.

    1. Sign in to the Microsoft Entra admin center as at least a Hybrid Identity Administrator.
    2. Browse to Entra ID > Groups > All groups.
    3. At the top, select New group.
    4. Make sure the Group type is set to security.
    5. For the Group Name, enter Sales.
    6. For Membership type, keep it at assigned.
    7. Select Create.
    8. Repeat this process using Marketing as the Group NameName..

    Now add

    Add users to the newly created groups you created.

    1. Sign in to the Microsoft Entra admin center as at least a Hybrid Identity Administrator.
    2. Browse to Entra ID > Groups > All groups.
    3. At the top, in the search box, enter Sales.
    4. Select the new Sales group.
    5. On the left, select Members.
    6. At the top, select Add members.
    7. At the top, in the search box, enter Britta Simon.
    8. Put a check next to Britta Simon and Anna Ringdahl, and then select Select.
    9. It should successfully add her to the group.
    10. On the far left, select All groups and repeat this process using the Marketing group,group and adding Lola Jacobson and John Smith. to that group.

    Install and connect Microsoft Graph PowerShell SDK

    1. If not yet installed, follow Microsoft Graph PowerShell SDK

      Identify documentation to install the cloud-managed user you wantmain modules of Microsoft Graph PowerShell SDK: Microsoft.Graph.

    2. Open PowerShell with Administrative privileges

    3. To set the execution policy, run (press [A] Yes to provisionall when prompted):

      Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
      
    4. Connect to Active Directory,your tenant (Be sure to accept on-behalf of when signing in):

      Connect-MgGraph -Scopes "Directory.ReadWrite.All", "Application.ReadWrite.All", "User.ReadWrite.All, Group.ReadWrite.All"
      

    Create our CloudSyncCustomExtensionApp application and confirm you can retrieve it:service principal

    1. Get the Tenant ID:

      $tenantId

    1. Using the $tenantId variable from the previous step, check to see if the CloudSyncCustomExtensionApp exists.

      $testUsercloudSyncCustomExtApp = Get-MgUserMgApplication -Filter "userPrincipalNameidentifierUris/any(uri:uri eq '<test-user-UPN>api://$tenantId/CloudSyncCustomExtensionsApp')"
      $testUser$cloudSyncCustomExtApp
      
    2. You can optionally bring the user into scope throughIf a group instead of selecting the user directly:

      1. Create an assigned Microsoft Entra security group, such as AD-Provisioning-Test.
      2. Add the cloud-managed test userCloudSyncCustomExtensionApp exists, skip to the group.next step. Otherwise, create the new CloudSyncCustomExtensionApp app:
        $cloudSyncCustomExtApp = New-MgApplication -DisplayName "CloudSyncCustomExtensionsApp" -IdentifierUris "api://$tenantId/CloudSyncCustomExtensionsApp"
        $cloudSyncCustomExtApp
        
      3. Select that group when

        Check if CloudSyncCustomExtensionsApp application has a security principal associated. If you configure user scope in cloud sync.just created a new app, skip to the next step.

        Get-MgServicePrincipal -Filter "AppId eq '$($cloudSyncCustomExtApp.AppId)'"
        
      4. If you just created a new app or a security principal is not returned, create a security principal for CloudSyncCustomExtensionsApp:

        New-MgServicePrincipal -AppId $cloudSyncCustomExtApp.AppId
        

      Create the directory extension

      Groups

      Under the CloudSyncCustomExtensionsApp, create the extension attribute and assign it to Group objects:

      New-MgApplicationExtensionProperty -ApplicationId $cloudSyncCustomExtApp.Id -Name 'WritebackEnabled' -DataType 'Boolean' -TargetObjects 'Group'
      

      This cmdlet creates an extension attribute that looks like extension_<AppIdWithoutHyphens>_WritebackEnabled.

      Users

      Create our custom extension attribute

      1. UnderGet the CloudSyncCustomExtensionsApp,Tenant ID:

        $tenantId = (Get-MgOrganization).Id
        $tenantId
        
      2. Get the CloudSyncCustomExtensionsApp application:

        $cloudSyncCustomExtApp = Get-MgApplication -Filter "identifierUris/any(uri:uri eq 'api://$tenantId/CloudSyncCustomExtensionsApp')"
        
      3. Now, under the CloudSyncCustomExtensionApp, create the custom extension attribute called "WritebackEnabled" and assign it to UserGroup objects:

        New-MgApplicationExtensionProperty -ApplicationId $cloudSyncCustomExtApp.Id -Name 'EmployeeCodeWritebackEnabled' -DataType 'StringBoolean' -TargetObjects 'UserGroup'
        
      4. This cmdlet creates an extension attribute that looks like extension_<AppIdWithoutHyphensguid>_EmployeeCode. Retrieve the generated name, because you need it when you add the attribute mapping:

        $userExtension = Get-MgApplicationExtensionProperty -ApplicationId $cloudSyncCustomExtApp.Id |
            Where-Object Name -Like '*_EmployeeCode' | Select-Object -First 1
        
        $userExtensionName = $userExtension.Name
        $userExtensionName
        

        Set the extension value

        Groups

        Set a value on the newly created property for the Marketing group.

        1. Get the extension property:

          $gwbEnabledExtAttrib = Get-MgApplicationExtensionProperty -ApplicationId $cloudSyncCustomExtApp.Id |
              Where-Object {$_.Name -Like '*WritebackEnabled'} | Select-Object -First 1
          $gwbEnabledExtName = $gwbEnabledExtAttrib.Name
          
        2. Get the Marketing group:

          $marketingGrp = Get-MgGroup -ConsistencyLevel eventual -Filter "DisplayName eq 'Marketing'"
          
        3. Set the value True for the Marketing group:

          Update-MgGroup -GroupId $marketingGrp.Id -AdditionalProperties @{$gwbEnabledExtName = $true}
          
        4. To confirm, read the property value:

          $marketingGrp = Get-MgGroup -ConsistencyLevel eventual -Filter "DisplayName eq 'Marketing'" -Property Id,$gwbEnabledExtName
          $marketingGrp.AdditionalProperties.$gwbEnabledExtName
          

        Users

        1. Set the value on the test user:

          Update-MgUser -UserId $testUser.Id -AdditionalProperties @{ $userExtensionName = "EMP-1001" }
          
        2. To confirm, read the property value:

          $testUser = Get-MgUser -UserId $testUser.Id -Property "id,displayName,$userExtensionName"
          $testUser.AdditionalProperties[$userExtensionName]
          

        Set the extension value by using Microsoft Graph Explorer

        You can set the value through Microsoft Graph Explorer instead of PowerShell. Make sure you consented to the required permission by selecting Modify permissions.

        Groups

        1. Navigate to Microsoft Graph Explorer and consent to Group.ReadWrite.All.

        2. Sign in using your tenant administrator account. A Hybrid Identity Administrator account was used to create this scenario and might be sufficient.

        3. At the top, change GET to PATCH.

        4. In the address box, enter https://graph.microsoft.com/v1.0/groups/<Group Id>.

        5. In the request body, enter:

          {
            "extension_<AppIdWithoutHyphens>_WritebackEnabled": true
          }
          
        6. Select Run query.

          :::image type="content" source="media/tutorial-directory-extension-group-provision/directory-extension-group-provision-1.png" alt-text="Screenshot of running the graph query." lightbox="media/tutorial-directory-extension-group-provision/directory-extension-group-provision-1.png":::

        7. If done correctly, you see [].

        8. At the top, change PATCH to GET and look at the properties of the Marketing group. Select Run query. You should see the newly created attribute.

          :::image type="content" source="media/tutorial-directory-extension-group-provision/directory-extension-group-provision-2.png" alt-text="Screenshot of group properties." lightbox="media/tutorial-directory-extension-group-provision/directory-extension-group-provision-2.png":::_WritebackEnabled.

        Users

        1. Navigate to Microsoft Graph Explorer and consent to User.ReadWrite.All.

        2. Sign in using your tenant administrator account.

        3. At the top, change GET to PATCH.

        4. In the address box, enter https://graph.microsoft.com/v1.0/users/<User Id>.

        5. In the request body, enter:

          {
            "extension_<AppIdWithoutHyphens>_EmployeeCode": "EMP-1001"
          }
          
        6. Select Run query.

        7. At the top, change PATCH to GET and look at the properties of the user. Select Run query. You should see the newly created attribute.


        Use the extension in yourCreate our cloud sync configuration

        Groups

        1. Sign in to the Microsoft Entra admin center as at least a Hybrid Identity Administrator.

        2. Browse to Entra ID > Entra Connect > Cloud sync.

        3. Select New configuration.

        4. Select Microsoft Entra ID to AD sync.

        :: :::image type="content" source="media/how-to-configure-entra-to-active-directory/entra-to-ad-1.png" alt-text="Screenshot of configuration selection." lightbox="media/how-to-configure-entra-to-active-directory/entra-to-ad-1.png":::

        1. On the configuration screen, select your domain.domain and whether to enable password hash sync. Select Create.

        :: :::image type="content" source="media/how-to-configure/new-ux-configure-2.png" alt-text="Screenshot of a new configuration." lightbox="media/how-to-configure/new-ux-configure-2.png":::

        1. The Get started screen opens. From here, you can continue configuring cloud sync.sync

        2. On the left, select Scoping filters, then select Group scope > All groups.

        3. Select Edit attribute mapping and change the Target Container to OU=Groups,DC=Contoso,DC=com. Select Save.

        4. Select Add Attribute scoping filter.

        5. Type a name for the scoping filter: Filter groups with Writeback Enabled.

        6. Under Target Attribute, select the newly created attribute that looks like extension_<AppIdWithoutHyphensguid>_WritebackEnabled._WritebackEnabled.

        :::image type="content" source="media/tutorial-directory-extension-group-provision/directory-extension-group-provision-4.png" alt-text="Screenshot of available attributes." lightbox="media/tutorial-directory-extension-group-provision/directory-extension-group-provision-4.png":::

        1. Under Operator select IS TRUE.
        2. Select Save, and then select Save.
        3. Leave the configuration disabled and come back to it.

        Add new extension property to one of our groups

        For this portion, we're going add a value on our newly created property to one of our existing groups, Marketing.

        Set the extension property value using Microsoft Graph PowerShell SDK

        1. Get the Tenant ID:

          $tenantId = (Get-MgOrganization).Id
          $tenantId
          
        2. Get the CloudSyncCustomExtensionsApp application:

          $cloudSyncCustomExtApp = Get-MgApplication -Filter "identifierUris/any(uri:uri eq 'api://$tenantId/CloudSyncCustomExtensionsApp')"
          
        3. Get our extension property:

          $gwbEnabledExtAttrib = Get-MgApplicationExtensionProperty -ApplicationId $cloudSyncCustomExtApp.Id |
              Where-Object {$_.Name -Like '*WritebackEnabled'} | Select-Object -First 1
          $gwbEnabledExtAttrib
          $gwbEnabledExtName = $gwbEnabledExtAttrib.Name
          
        4. Now, get the Marketing group:

          $marketingGrp = Get-MgGroup -ConsistencyLevel eventual -Filter "DisplayName eq 'Marketing'"
          $marketingGrp
          
        5. Then, with the variable $gwbEnabledExtName containing extension_<guid>_WritebackEnabled, set the value True for the Marketing group:

          Update-MgGroup -GroupId $marketingGrp.Id -AdditionalProperties @{$gwbEnabledExtName = $true}
          
        6. To confirm, you can read the extension_<guid>_WritebackEnabled property value with:

          $marketingGrp = Get-MgGroup -ConsistencyLevel eventual -Filter "DisplayName eq 'Marketing'" -Property Id,$gwbEnabledExtName
          $marketingGrp.AdditionalProperties.$gwbEnabledExtName
          

        Set the extension property value using Microsoft Graph Explorer

        You need to make sure that you have consented to Group.ReadWrite.All. You can do this by selecting Modify permissions.

        1. Navigate to Microsoft Graph Explorer

          1. Sign in using your tenant administrator account. A Hybrid Identity Administrator account was used to create this scenario and might be sufficient.

          2. At the Microsoft Entra admin center as at least a Hybrid Identity Administratortop, change the GET to PATCH

          3. In the address box enter: https://graph.microsoft.com/v1.0/groups/<Group Id>

          4. In the Request body enter:

            {
              "extension_<guid>_WritebackEnabled": true
            }
            
          5. Select Run query. :::image type="content" source="media/tutorial-directory-extension-group-provision/directory-extension-group-provision-1.png" alt-text="Screenshot of running the graph query." lightbox="media/tutorial-directory-extension-group-provision/directory-extension-group-provision-1.png":::

          6. If done correctly, you see [].

          7. BrowseNow at the top, change PATCH to Entra IDGET > Entra Connect > Cloud sync.and look at the properties of the marketing group.

          8. Select New configurationRun query and select Microsoft Entra ID to AD sync, or open an existing configuration.

          9. Select. You should see the Active Directory domain and a healthy provisioning agent.

          10. On the left, select Scoping filters, and configure User scope. Select the test user directly, or select thenewly created attribute. :::image type="content" source="media/tutorial-directory-extension-group-provision/directory-extension-group-provision-2.png" alt-text="Screenshot of group that contains the user.

          11. Select Edit attribute mapping for users and set the Target Container to the complete Active Directory distinguished name, for example OU=test,DC=Contoso,DC=com.

          12. Add the attribute mapping:

            SettingValue
            Mapping typeDirect
            Source attributeextension_<AppIdWithoutHyphens>_EmployeeCode
            Target attributeextensionAttribute1, or another writable Active Directory user attribute
          13. Select Save.

          14. Leave the configuration disabled until you review the scope, target container, and mappings.properties." lightbox="media/tutorial-directory-extension-group-provision/directory-extension-group-provision-2.png":::


          Test and verifyour configuration

          Groups

          [!INCLUDE sign in]

          1. Under Configuration, select your configuration.

          2. On the left, select Provision on demand.

          3. Enter Marketing in the Selected group box.box

          4. From the Selected users section, select some users to test. Select Lola Jacobson and John Smith.

          5. Select Provision. It should successfully provision.

            :: :::image type="content" source="media/tutorial-directory-extension-group-provision/directory-extension-group-provision-5.png" alt-text="Screenshot of successful provision." lightbox="media/tutorial-directory-extension-group-provision/directory-extension-group-provision-5.png":::

          6. Now try with the Sales group and add Britta Simon and Anna Ringdahl. This shouldn't provision, because the Sales group doesn't have the extension value set.

            ::provision. :::image type="content" source="media/tutorial-directory-extension-group-provision/directory-extension-group-provision-6.png" alt-text="Screenshot of provisioning being blocked." lightbox="media/tutorial-directory-extension-group-provision/directory-extension-group-provision-6.png":::

          7. In Active Directory, you should see the newly created Marketing group.

            :: :::image type="content" source="media/tutorial-directory-extension-group-provision/directory-extension-group-provision-7.png" alt-text="Screenshot of new group in active directory users and computers." lightbox="media/tutorial-directory-extension-group-provision/directory-extension-group-provision-7.png":::

          8. You can now browse to Entra ID > Entra Connect > Cloud sync > Overview page to reviewReview and enable yourEnable our configuration andto start synchronizing.

          Users

          [!INCLUDE sign in]

          1. Under Configuration, select your configuration.
          2. On the left, select Provision on demand.
          3. Select the test user. If you used group scope, select the group and then explicitly select the test user.
          4. Select Provision.
          5. Review the import, scope evaluation, matching, and export steps.

          Confirm the value landed in Active Directory:

          Get-ADUser -Filter "UserPrincipalName -eq '<test-user-UPN>'" -SearchBase "OU=test,DC=Contoso,DC=com" -Properties extensionAttribute1 |
              Select-Object DistinguishedName,extensionAttribute1
          

          The expected value is extensionAttribute1 = EMP-1001.

          To review the result in the provisioning logs, browse to Entra ID > Monitoring & health > Provisioning logs and filter by the test user and your cloud sync configuration. Confirm that:

          • Scope evaluation passed.
          • The user was created or matched in Active Directory.
          • Under Modified properties, the directory extension was mapped to extensionAttribute1.
          • The export operation succeeded.

          Directory extensions on users converted from Active Directory

          When you convert a user's Source of Authority to Microsoft Entra ID, the attributes that Active Directory previously owned must already be visible in Microsoft Entra ID, either as directory attributes or as directory schema extensions. For the full list of preconditions, see Prepare your environment to convert user Source of Authority.

          That means a converted user usually already has the extension values it needs, so you don't create new extensions for those attributes. Instead, you map from the extensions that already hold the values.

          Extensions created by Microsoft Entra Connect live on the Tenant Schema Extension App, which is supported as a mapping source alongside CloudSyncCustomExtensionsApp. Add the mapping the same way as in the Users tab, selecting the existing extension as the source attribute. Converting Source of Authority doesn't require you to re-register or recreate the extension.

          Next step

          [!div class="nextstepaction"] Test and enable provisioning

          Related contentsteps

    Daily Entra.News

    Get daily email updates

    Get a concise summary of the latest Microsoft Entra updates delivered straight to your inbox.

    Loading the secure signup form…