How to add Group Membership in a Dynamic Group

Featured image

With Microsoft’s introduction of this new feature, Groups can now be added as members of a dynamic group via the Azure Portal.

With this preview, admins can configure dynamic groups with the memberOf attribute in the Azure Portal, Microsoft Graph, and PowerShell.

Points to ponder

Pre-requisites

A user had to satisfy the below criteria to use this feature.

      User must possess any of the roles - Global Administrator, Intune Administrator, or User Administrator role.

      The Azure AD tenant must possess Azure AD Premium license.

How to use memberOf attribute in a dynamic group

Follow the below steps to make use of the attribute in a dynamic group

  1. Login to the Azure Portal as an admin with any of the roles mentioned in the previous step
  2. Navigate to Azure Active Directory -> Groups. Click on ‘New group’
  3. Fill in the necessary group details
  4. The Group type can be either ‘Security’ or ‘Microsoft 365’
  5. Choose Membership type : If you choose a Security group – you have to choose between the Membership types – ‘Dynamic User’ or ‘Dynamic Device’ as applicable. For a ‘Microsoft 365’ Group – you have only one Dynamic option – Dynamic User
  6. Select “Add dynamic query”
  7. MemberOf is not yet supported in the rule builder. So, select Edit to frame the rule in the Rule syntax box
  8. Enter the query as applicable and click OK.
    To add users part of another group, enter the query as below
    user.memberof -any (group.objectId -in [‘groupId1’, ‘groupId2’,...])
    To add devices part of another group, enter the query as below
    device.memberof -any (group.objectId -in [‘groupId1’, ‘groupId2’,...])
  9. Save the dynamic query & Create the group.

View of the created Dynamic Group

The members of the groups included in the dynamic query gets added to the Dynamic Group automatically.

When members are added / removed from the member group, it reflects in the dynamic group as well.

Preview limitations

Reference : Microsoft Documentation : Group membership in a dynamic group