How to prevent users from creating groups in Office 365

Hi everyone,

This video will show how to prevent or limit users from creating groups in Office 365. By default, all users can create Microsoft 365 groups.

When you limit who can create a group, it affects all services that rely on groups for access, including:

  • Outlook
  •  SharePoint
  • Yammer
  • MS Teams 
  • MS Stream
  • Planner
  • Power BI (Classic)
  • Project for the Web/Roadmap

PowerShell commands:

$GroupName = “<GroupName>”
$AllowGroupCreation = $False

Connect-AzureAD

$settingsObjectID = (Get-AzureADDirectorySetting | Where-object -Property Displayname -Value “Group.Unified” -EQ).id
if(!$settingsObjectID)
{
$template = Get-AzureADDirectorySettingTemplate | Where-object {$_.displayname -eq “group.unified”}
$settingsCopy = $template.CreateDirectorySetting()
New-AzureADDirectorySetting -DirectorySetting $settingsCopy
$settingsObjectID = (Get-AzureADDirectorySetting | Where-object -Property Displayname -Value “Group.Unified” -EQ).id
}

$settingsCopy = Get-AzureADDirectorySetting -Id $settingsObjectID
$settingsCopy[“EnableGroupCreation”] = $AllowGroupCreation

if($GroupName)
{
$settingsCopy[“GroupCreationAllowedGroupId”] = (Get-AzureADGroup -SearchString $GroupName).objectid
} else {
$settingsCopy[“GroupCreationAllowedGroupId”] = $GroupName
}
Set-AzureADDirectorySetting -Id $settingsObjectID -DirectorySetting $settingsCopy

(Get-AzureADDirectorySetting -Id $settingsObjectID).Values

 

 

8 thoughts on “How to prevent users from creating groups in Office 365

Leave a Reply

Your email address will not be published. Required fields are marked *