You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Config/standards.json
+17-4Lines changed: 17 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -1459,10 +1459,23 @@
1459
1459
"cat": "Entra (AAD) Standards",
1460
1460
"tag": ["CISA (MS.AAD.21.1v1)", "SMB1001 (2.8)"],
1461
1461
"appliesToTest": ["SMB1001_2_8", "ZTNA21868"],
1462
-
"helpText": "Restricts M365 group creation to certain admin roles. This disables the ability to create Teams, SharePoint sites, Planner, etc",
1463
-
"docsDescription": "Users by default are allowed to create M365 groups. This restricts M365 group creation to certain admin roles. This disables the ability to create Teams, SharePoint sites, Planner, etc",
1464
-
"executiveText": "Restricts the creation of Microsoft 365 groups, Teams, and SharePoint sites to authorized administrators, preventing uncontrolled proliferation of collaboration spaces. This ensures proper governance, naming conventions, and resource management while maintaining oversight of all collaborative environments.",
1465
-
"addedComponent": [],
1462
+
"helpText": "Restricts M365 group creation to certain admin roles. This disables the ability to create Teams, SharePoint sites, Planner, etc. Optionally allows members of a specific security group to keep creating groups (GroupCreationAllowedGroupId).",
1463
+
"docsDescription": "Users by default are allowed to create M365 groups. This restricts M365 group creation to certain admin roles. This disables the ability to create Teams, SharePoint sites, Planner, etc. Optionally, a security group can be named whose members remain allowed to create groups; the group is resolved by display name in each tenant and can be created automatically when it does not exist. When no group is named, the existing GroupCreationAllowedGroupId value in the tenant is left untouched.",
1464
+
"executiveText": "Restricts the creation of Microsoft 365 groups, Teams, and SharePoint sites to authorized administrators, preventing uncontrolled proliferation of collaboration spaces. This ensures proper governance, naming conventions, and resource management while maintaining oversight of all collaborative environments. An approved group of designated users can optionally retain the ability to create groups.",
Copy file name to clipboardExpand all lines: Modules/CIPPStandards/Public/Standards/Invoke-CIPPStandardDisableM365GroupUsers.ps1
+74-25Lines changed: 74 additions & 25 deletions
Original file line number
Diff line number
Diff line change
@@ -7,17 +7,19 @@ function Invoke-CIPPStandardDisableM365GroupUsers {
7
7
.SYNOPSIS
8
8
(Label) Disable M365 Group creation by users
9
9
.DESCRIPTION
10
-
(Helptext) Restricts M365 group creation to certain admin roles. This disables the ability to create Teams, SharePoint sites, Planner, etc
11
-
(DocsDescription) Users by default are allowed to create M365 groups. This restricts M365 group creation to certain admin roles. This disables the ability to create Teams, SharePoint sites, Planner, etc
10
+
(Helptext) Restricts M365 group creation to certain admin roles. This disables the ability to create Teams, SharePoint sites, Planner, etc. Optionally allows members of a specific security group to keep creating groups (GroupCreationAllowedGroupId).
11
+
(DocsDescription) Users by default are allowed to create M365 groups. This restricts M365 group creation to certain admin roles. This disables the ability to create Teams, SharePoint sites, Planner, etc. Optionally, a security group can be named whose members remain allowed to create groups; the group is resolved by display name in each tenant and can be created automatically when it does not exist. When no group is named, the existing GroupCreationAllowedGroupId value in the tenant is left untouched.
12
12
.NOTES
13
13
CAT
14
14
Entra (AAD) Standards
15
15
TAG
16
16
"CISA (MS.AAD.21.1v1)"
17
17
"ZTNA21868"
18
18
EXECUTIVETEXT
19
-
Restricts the creation of Microsoft 365 groups, Teams, and SharePoint sites to authorized administrators, preventing uncontrolled proliferation of collaboration spaces. This ensures proper governance, naming conventions, and resource management while maintaining oversight of all collaborative environments.
19
+
Restricts the creation of Microsoft 365 groups, Teams, and SharePoint sites to authorized administrators, preventing uncontrolled proliferation of collaboration spaces. This ensures proper governance, naming conventions, and resource management while maintaining oversight of all collaborative environments. An approved group of designated users can optionally retain the ability to create groups.
20
20
ADDEDCOMPONENT
21
+
{"type":"textField","name":"standards.DisableM365GroupUsers.AllowedGroupName","label":"Optional: name of the group whose members may still create M365 groups","required":false}
22
+
{"type":"switch","name":"standards.DisableM365GroupUsers.CreateGroup","label":"Create the allowed group if it does not exist","required":false}
21
23
IMPACT
22
24
Low Impact
23
25
ADDEDDATE
@@ -55,21 +57,74 @@ function Invoke-CIPPStandardDisableM365GroupUsers {
55
57
return
56
58
}
57
59
60
+
# Optional: a group whose members remain allowed to create M365 groups
61
+
# (GroupCreationAllowedGroupId). Resolved by display name per tenant, since group ids
62
+
# differ between tenants. When no name is configured the setting is left untouched,
Write-LogMessage-API 'Standards'-tenant $Tenant-message "Multiple groups named '$AllowedGroupName' found, using the first match ($($AllowedGroup[0].id))."-sev Warning
72
+
}
73
+
$DesiredGroupId=$AllowedGroup|Select-Object-First 1-ExpandProperty id
Write-LogMessage-API 'Standards'-tenant $Tenant-message "Created group '$AllowedGroupName' ($DesiredGroupId) for allowed M365 group creation."-sev Info
106
+
}
107
+
if (-not [string]::IsNullOrWhiteSpace($AllowedGroupName) -and-not$DesiredGroupId) {
108
+
Write-LogMessage-API 'Standards'-tenant $Tenant-message "The allowed group '$AllowedGroupName' does not exist in the tenant and 'Create the allowed group' is not enabled. Group creation will be disabled without an allowed group."-sev Warning
109
+
}
110
+
63
111
if (!$CurrentState) {
64
112
# If no current configuration is found, we set it to the default template supplied by MS.
Write-LogMessage-API 'Standards'-tenant $tenant-message 'Disabled users from creating M365 Groups.'-sev Info
123
+
if ($DesiredGroupId) {
124
+
Write-LogMessage-API 'Standards'-tenant $tenant-message "Disabled users from creating M365 Groups. Members of '$AllowedGroupName' remain allowed to create groups."-sev Info
125
+
} else {
126
+
Write-LogMessage-API 'Standards'-tenant $tenant-message 'Disabled users from creating M365 Groups.'-sev Info
Write-LogMessage-API 'Standards'-tenant $tenant-message "Failed to disable users from creating M365 Groups: $ErrorMessage"-sev 'Error'
@@ -78,38 +133,32 @@ function Invoke-CIPPStandardDisableM365GroupUsers {
78
133
}
79
134
if ($Settings.alert-eq$true) {
80
135
81
-
if ($CurrentState) {
82
-
if (($CurrentState.values|Where-Object { $_.name-eq'EnableGroupCreation' }).value -eq'false') {
83
-
Write-LogMessage-API 'Standards'-tenant $tenant-message 'Users are disabled from creating M365 Groups.'-sev Info
84
-
} else {
85
-
Write-StandardsAlert-message 'Users are not disabled from creating M365 Groups.'-object $CurrentState-tenant $tenant-standardName 'DisableM365GroupUsers'-standardId $Settings.standardId
86
-
Write-LogMessage-API 'Standards'-tenant $tenant-message 'Users are not disabled from creating M365 Groups.'-sev Info
87
-
}
136
+
if ($StateIsCorrect) {
137
+
Write-LogMessage-API 'Standards'-tenant $tenant-message 'Users are disabled from creating M365 Groups.'-sev Info
Write-StandardsAlert-message "Users are disabled from creating M365 Groups, but the allowed group '$AllowedGroupName' is not configured as GroupCreationAllowedGroupId."-object ($CurrentState??@{CurrentState=$null }) -tenant $tenant-standardName 'DisableM365GroupUsers'-standardId $Settings.standardId
140
+
Write-LogMessage-API 'Standards'-tenant $tenant-message "Users are disabled from creating M365 Groups, but the allowed group '$AllowedGroupName' is not configured."-sev Info
88
141
} else {
89
-
Write-StandardsAlert-message 'Users are not disabled from creating M365 Groups.'-object @{CurrentState=$null } -tenant $tenant-standardName 'DisableM365GroupUsers'-standardId $Settings.standardId
142
+
Write-StandardsAlert-message 'Users are not disabled from creating M365 Groups.'-object ($CurrentState??@{CurrentState=$null })-tenant $tenant-standardName 'DisableM365GroupUsers'-standardId $Settings.standardId
90
143
Write-LogMessage-API 'Standards'-tenant $tenant-message 'Users are not disabled from creating M365 Groups.'-sev Info
91
144
}
92
145
}
93
146
if ($Settings.report-eq$true) {
94
-
if ($CurrentState) {
95
-
if (($CurrentState.values|Where-Object { $_.name-eq'EnableGroupCreation' }).value -eq'false') {
96
-
$CurrentState=$true
97
-
} else {
98
-
$CurrentState=$false
99
-
}
100
-
} else {
101
-
$CurrentState=$false
102
-
}
103
-
104
147
$CurrentValue= [PSCustomObject]@{
105
-
M365GroupUserCreationDisabled=$CurrentState
148
+
M365GroupUserCreationDisabled=$CreationDisabled
106
149
}
107
150
$ExpectedValue= [PSCustomObject]@{
108
151
M365GroupUserCreationDisabled=$true
109
152
}
153
+
# Only include the allowed-group comparison when a group is configured, so existing
154
+
# deployments without one keep their original compare shape (backward compatible)
155
+
if (-not [string]::IsNullOrWhiteSpace($AllowedGroupName)) {
0 commit comments