# ========================================================================================
# Update an existing directory settings to disallow Office 365 Group Creation by users NOT in the
# proper Azure AD group. The directory settings must exist first.
#
# More info at: http://drp.mk/i/yTWX9dvJ42
# ========================================================================================
# 1) Grab the directorysetting
$setting = Get-AzureADDirectorySetting -Id (Get-AzureADDirectorySetting | where -Property DisplayName -Value "Group.Unified" -EQ).id # Grab the setting
# 2) Set properties for the setting
$setting["GroupCreationAllowedGroupId"] = (Get-AzureADGroup -SearchString "<NAME-OF-YOUR_GROUP>").objectid
$setting["EnableGroupCreation"] = $False
# 3) Update the setting.
Set-AzureADDirectorySetting -Id $setting.Id -DirectorySetting $setting
Comments