How To: Limit Office 365 Group Creation with PowerShell

In our webinar, Drive Adoption of Office 365 Groups and SharePoint Sites, we were asked how to limit creation of new SharePoint Sites. Our answer: Start by limiting who can create groups.

For the bigger reference, use this Microsoft article.

However, here’s my personal Coles Notes I keep so I can get right down to it (replace items in green with your appropriate values).

Note: “Allow Creation of Office 365 Groups” is the name of a Security Group created already in Office 365 that contains the names of users that we wish to be able to create Office 365 groups
install-module azureadpreview

import-module azureadpreview

connect-azuread

Get-AzureADGroup -SearchString "Allow Creation of Office 365 Groups"

$Template = Get-AzureADDirectorySettingTemplate | where {$_.DisplayName -eq 'Group.Unified'}

$Setting = $Template.CreateDirectorySetting()

New-AzureADDirectorySetting -DirectorySetting $Setting 

#****the above should return an ID****
$Setting = Get-AzureADDirectorySetting -Id (Get-AzureADDirectorySetting | where -Property DisplayName -Value "Group.Unified" -EQ).id

$Setting["EnableGroupCreation"] = $False

$Setting["GroupCreationAllowedGroupId"] = (Get-AzureADGroup -SearchString "Allow Creation of Office 365 Groups").objectid

Set-AzureADDirectorySetting -Id (Get-AzureADDirectorySetting | where -Property DisplayName -Value "Group.Unified" -EQ).id -DirectorySetting $Setting

(Get-AzureADDirectorySetting).Values

This is the desired result:

Desired result

Desired result

Reference:

Wallbridge, S. (2018). How To: Limit Office 365 Group Creation with PowerShell. Available at: http://itgroove.net/studios/how-to-limit-office-365-group-creation-with-powershell [Accessed: 9 August 2018]

Share this on...

Rate this Post:

Share: