Manage who can create Office 365 Groups

Source:
https://docs.microsoft.com/en-gb/office365/admin/create-groups/manage-creation-of-groups?view=o365-worldwide

365 Security group
Name: Allowtocreategroups
Description: Members of this security group can create 365 groups.

Powershell
Install-Module AzureADPreview -force
To install the latest version of AzureADPreview, run this command

Get-InstalledModule -Name "AzureAD*"
Check installed module

Uninstall-Module AzureADPreview or Uninstall-Module AzureAD
To uninstall a previous version of AzureADPreview or AzureAD, run this command

GroupCreators.ps1

$GroupName = "Allowtocreategroups"
$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}

Set-AzureADDirectorySetting -Id $settingsObjectID -DirectorySetting $settingsCopy

(Get-AzureADDirectorySetting -Id $settingsObjectID).Values