IMPORTANT:
Cloud Modernization Notice (2026):
The preview cmdletsGet-AzureADDirectorySettingTemplate,New-AzureADDirectorySetting, andSet-AzureADDirectorySettingare retired alongside the AzureAD module.
> This article has been updated with modern, supported Microsoft Graph PowerShell SDK (Get-MgDirectorySetting&Update-MgDirectorySetting) commands. Historical AzureAD commands are preserved below for reference.
By default, every licensed user in a Microsoft 365 tenant has permission to create Microsoft 365 Groups (Unified Groups). Because Microsoft 365 Groups underpin Microsoft Teams, Planner, SharePoint team sites, and Yammer/Viva Engage, open self-service group creation frequently leads to tenant sprawl, duplicate teams, and governance headaches.
To enforce governance, enterprise organizations restrict group creation so that only members of an approved IT or business security group can create new groups and teams.
In this guide, we walk through how to restrict Microsoft 365 group creation using Microsoft Graph PowerShell SDK, inspect the directory settings, and restore defaults if needed.
Expected Impact of Restricting Group Creation
When group creation is restricted, standard users cannot create new groups or teams across:
- Microsoft Teams: The "Create team" button is hidden or disabled.
- Outlook on the web / Outlook Desktop: The "New Group" option is hidden.
- SharePoint Online: Users cannot create modern team sites (they can still create communication sites if allowed).
- Planner: Users cannot create new plans that require a new M365 Group.
- Viva Engage (Yammer): Users cannot create new communities.
NOTE:
Who is exempt?
In addition to members of your designated security group, users assigned built-in directory roles (Global Administrator, Exchange Administrator, SharePoint Administrator, Groups Administrator, Teams Administrator, and User Administrator) can always create groups regardless of this policy.
Licensing Requirement
Configuring group creation restrictions requires Microsoft Entra ID P1 or P2 (or Microsoft 365 E3/E5) for the administrators configuring the settings, and for the members of the designated group permitted to create groups.
Modern Method: Microsoft Graph PowerShell SDK
Step 1: Connect to Microsoft Graph
Connect with directory management permissions:
# Install the Identity Directory Management module
Install-Module Microsoft.Graph.Identity.DirectoryManagement, Microsoft.Graph.Groups -Scope CurrentUser -Repository PSGallery -Force
# Connect to Graph
Connect-MgGraph -Scopes "Directory.ReadWrite.All", "Group.Read.All"
Step 2: Create or Identify Your Allowed Security Group
Create an Entra ID security group (e.g., "AllowGroupCreation") and add the users who should retain group creation permissions.
Query its Object ID using PowerShell:
$targetGroup = Get-MgGroup -Filter "displayName eq 'AllowGroupCreation'" -Property "Id", "DisplayName"
if (-not $targetGroup) {
Throw "Security group 'AllowGroupCreation' not found! Please create it first."
}
$allowedGroupId = $targetGroup.Id
Write-Host "Target Security Group ID: $allowedGroupId" -ForegroundColor Green
Step 3: Check for Existing Group.Unified Directory Settings
Entra ID stores tenant-wide group policies inside a directorySetting object derived from the Group.Unified template. Let's check if your tenant already has one created:
$existingSetting = Get-MgDirectorySetting | Where-Object { $_.DisplayName -eq "Group.Unified" }
Step 4: Configure Group Creation Restriction
Scenario A: The Group.Unified Setting Does Not Exist Yet
If your tenant has never customized group settings, retrieve the Group.Unified template ID and instantiate the setting:
if (-not $existingSetting) {
Write-Host "Creating new Group.Unified directory setting..." -ForegroundColor Yellow
# Get the Group.Unified template ID
$template = Get-MgDirectorySettingTemplate | Where-Object { $_.DisplayName -eq "Group.Unified" }
$params = @{
templateId = $template.Id
values = @(
@{
name = "EnableGroupCreation"
value = "false"
},
@{
name = "GroupCreationAllowedGroupId"
value = $allowedGroupId
}
)
}
New-MgDirectorySetting -BodyParameter $params
Write-Host "[+] Group creation restriction successfully created!" -ForegroundColor Green
}
Scenario B: The Group.Unified Setting Already Exists
If you already have a Group.Unified setting (for instance, configured for custom blocked words or guest access policies), update the existing object:
if ($existingSetting) {
Write-Host "Updating existing Group.Unified directory setting ($($existingSetting.Id))..." -ForegroundColor Yellow
$values = @()
foreach ($val in $existingSetting.Values) {
if ($val.Name -eq "EnableGroupCreation") {
$values += @{ name = "EnableGroupCreation"; value = "false" }
} elseif ($val.Name -eq "GroupCreationAllowedGroupId") {
$values += @{ name = "GroupCreationAllowedGroupId"; value = $allowedGroupId }
} else {
$values += @{ name = $val.Name; value = $val.Value }
}
}
Update-MgDirectorySetting -DirectorySettingId $existingSetting.Id -Values $values
Write-Host "[+] Group creation restriction successfully updated!" -ForegroundColor Green
}
Step 5: Verify Configuration
To verify that the settings took effect:
$current = Get-MgDirectorySetting | Where-Object { $_.DisplayName -eq "Group.Unified" }
$current.Values | Select-Object Name, Value | Format-Table -AutoSize
Expected output:
Name Value
---- -----
EnableGroupCreation false
GroupCreationAllowedGroupId 7b29e012-3456-4abc-8def-123456789abc
...
(Note: Changes take between 15 to 30 minutes to replicate across all workloads like Teams and SharePoint Online).
How to Remove Restrictions (Restore Default Behavior)
If you ever wish to revert your tenant to the default state where all licensed users can create groups, you can simply delete the Group.Unified directory setting:
$setting = Get-MgDirectorySetting | Where-Object { $_.DisplayName -eq "Group.Unified" }
if ($setting) {
Remove-MgDirectorySetting -DirectorySettingId $setting.Id
Write-Host "[✓] Custom group settings removed. All users can now create groups." -ForegroundColor Green
}
Alternatively, if you have other settings in Group.Unified that you want to retain, update EnableGroupCreation back to "true" and clear GroupCreationAllowedGroupId.
Archival Reference: Legacy AzureADPreview Method
Click to view the original 2019 AzureAD commands
Connect-AzureAD
$Templates = Get-AzureADDirectorySettingTemplate
$GroupTemplate = $Templates | Where-Object { $_.DisplayName -eq 'Group.Unified' }
$Setting = $GroupTemplate.CreateDirectorySetting()
$GroupID = (Get-AzureADGroup -SearchString "AllowGroupCreation").ObjectId
$Setting["GroupCreationAllowedGroupId"] = $GroupID
$Setting["EnableGroupCreation"] = $False
# Create new
New-AzureADDirectorySetting -DirectorySetting $Setting
# Or update existing
$SettingId = (Get-AzureADDirectorySetting -All $True | Where-Object { $_.DisplayName -eq "Group.Unified" }).Id
Set-AzureADDirectorySetting -Id $SettingId -DirectorySetting $Setting
# Remove restriction
Remove-AzureADDirectorySetting -Id $SettingId
Related reading: Get Microsoft 365 Group and Security Group Owner Details with Graph SDK · Auditing Entra Dynamic Groups for Retired memberOf Rules