Role-assignable security groups are the foundation for managing administrative access in Microsoft Entra ID without directly assigning roles to individual users. Instead of repeatedly assigning roles user by user, administrators can assign roles to a group and manage access simply by controlling group membership.
This article walks through a simple Microsoft Graph PowerShell script that creates a role-assignable security group in Microsoft 365—clean, minimal, and fully aligned with Graph requirements.
Try the M365Corner Microsoft 365 Reporting Tool — your DIY pack with 20+ out-of-the-box M365 reports for Users, Groups, and Teams.
# Define group details
$GroupName = "Role-Assignable-Security-Group-01"
# Create role-assignable security group
New-MgGroup -BodyParameter @{
displayName = $GroupName
description = "Role-assignable security group created using Graph PowerShell"
mailEnabled = $false
mailNickname = ($GroupName -replace '\s','').ToLower()
securityEnabled = $true
isAssignableToRole = $true
}
The script begins by storing the display name of the group in a variable:
$GroupName = "Role-Assignable-Security-Group-01"
This value is used consistently for:
The group is created using the New-MgGroup cmdlet with a -BodyParameter hashtable, which is the recommended and safest approach when working with Microsoft Graph PowerShell.
Key properties explained:
⚠️ Important:
A group must be created with isAssignableToRole = $true from the start.
Existing groups cannot be converted into role-assignable groups later.
Once you’re comfortable with this basic script, you can extend it in several useful ways:
| Error | Cause | Solution |
|---|---|---|
| Authorization_RequestDenied | The signed-in account does not have permission to create role-assignable groups. | Run the script using an account with sufficient Entra ID privileges, such as Privileged Role Administrator. |
| Request_BadRequest during group creation |
|
Ensure the group name generates a unique and valid mail nickname. Adjust naming conventions if required. |
| Attempting to modify an existing group Role assignable property cannot be updated |
isAssignableToRole cannot be added to an existing group. | Always create a new group with isAssignableToRole = $true. Conversion is not supported. |
| Group creation succeeds but role assignment later fails Role assignment errors in follow-up scripts |
Role-assignable group creation succeeded, but role management permissions are missing. | Ensure the account has both group management and directory role management privileges. |
Role-assignable security groups are a best practice for managing administrative access in Microsoft 365. This simple Graph PowerShell script provides a clean starting point for creating such groups correctly and consistently.
By combining this script with bulk creation, role assignment, and membership automation, administrators can build a scalable, auditable, and secure role management model—exactly the kind of automation that simplifies day-to-day Entra ID administration and aligns with modern RBAC practices.
© m365corner.com. All Rights Reserved. Design by HTML Codex