Office 365 – Disable users for group creation

If you want to restrict users to create teams group (disable create team option for all users) and only users who have permission to create group can able to create a team group.



Micorosft Article


  1. Create Security Group in Office 365 for Allow Create Groups Users

2. Open powershell window as administrator(try to run the powershell command in windows 10 machine, windows7 may give error)

Install-Module AzureADPreview

Check if Azure Module installed:

3. Save the following scripts in C:\GroupCreators.ps1

$GroupName = "SecurityEmailGroup"
$AllowGroupCreation = "False"
$settingsObjectID = (Get-AzureADDirectorySetting | Where-object -Property Displayname -Value "Group.Unified" -EQ).id
                  $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
                $settingsCopy["GroupCreationAllowedGroupId"] = (Get-AzureADGroup -SearchString $GroupName).objectid
Set-AzureADDirectorySetting -Id $settingsObjectID -DirectorySetting $settingsCopy
(Get-AzureADDirectorySetting -Id $settingsObjectID).Values



4. Open PowerShell As Administrator and run the following:

PS C:\WINDOWS\system32> cd\
PS C:\> cd\
PS C:\> .\GroupCreators.ps1

Now we can see the Script is running

After that only the users present in the security group and global admin can only able to create group.



User without permission to create teams group: