Simplify user tasks like bulk creation, updates, password resets, deletions, license checks & more — all from one place.
🚀 Launch ToolkitManaging group memberships manually can be time-consuming and error-prone. Microsoft 365 Dynamic Groups solve this by automatically managing group membership based on defined rules. In this article, you'll learn how to create and manage dynamic groups using Microsoft Graph PowerShell.
Microsoft 365 Dynamic groups automatically include members based on rules you define. These rules evaluate user or device attributes (like department, job title, or OS type) and update group membership accordingly.
Use the following PowerShell snippet to create a dynamic group based on the user's department:
$params = @{
DisplayName = "R&D Users"
Description = "Users in the R&D department"
MailNickname = "RDUsers"
MailEnabled = $false
SecurityEnabled = $true
GroupTypes = @("DynamicMembership")
MembershipRule = '(user.department -eq "R&D")'
MembershipRuleProcessingState = "On"
}
New-MgGroup -BodyParameter $params
âś… This creates a dynamic security group that auto-adds users from the R&D department.
Note: MembershipRule and MembershipRuleProcessingState properties attributes is what sets Microsoft 365 Dynamic Groups apart from non-dynamic groups.
To inspect the dynamic membership rule of an existing group:
Get-MgGroup -GroupId "" | Select-Object DisplayName, MembershipRule, MembershipRuleProcessingState
📌 Replace
Need to change the rule? For example, switch to users in the Engineering department:
$updateParams = @{
MembershipRule = '(user.department -eq "Engineering")'
MembershipRuleProcessingState = "On"
}
Update-MgGroup -GroupId "" -BodyParameter $updateParams
⚠️ This will re-evaluate membership based on the new rule.
Dynamic groups make it easy to automate membership based on organizational attributes. With Microsoft Graph PowerShell, you can create, view, and update these groups efficiently—ideal for IT admins looking to simplify access management.
© m365corner.com. All Rights Reserved. Design by HTML Codex