Create a security group in 365, add members (you can add a distribution list as the member) – I called my group blockteamscreation

 

Run powershell as admin, then run this: Install-Module AzureADPreview

 

Then run:

 

$GroupName = "<blockteamscreation>"

$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