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
+12-4Lines changed: 12 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -965,10 +965,18 @@
965
965
"name": "standards.DisableGuests",
966
966
"cat": "Entra (AAD) Standards",
967
967
"tag": [],
968
-
"helpText": "Blocks login for guest users that have not logged in for 90 days",
969
-
"executiveText": "Automatically disables external guest accounts that haven't been used for 90 days, reducing security risks from dormant accounts while maintaining access for active external collaborators. This helps maintain a clean user directory and reduces potential attack vectors.",
970
-
"addedComponent": [],
971
-
"label": "Disable Guest accounts that have not logged on for 90 days",
968
+
"helpText": "Blocks login for guest users that have not logged in for a number of days",
969
+
"executiveText": "Automatically disables external guest accounts that haven't been used for a number of days, reducing security risks from dormant accounts while maintaining access for active external collaborators. This helps maintain a clean user directory and reduces potential attack vectors.",
970
+
"addedComponent": [
971
+
{
972
+
"type": "number",
973
+
"name": "standards.DisableGuests.days",
974
+
"required": true,
975
+
"defaultValue": 90,
976
+
"label": "Days of inactivity"
977
+
}
978
+
],
979
+
"label": "Disable Guest accounts that have not logged on for a number of days",
$null=New-GraphPOSTRequest-uri $uri-tenantid $TenantFilter-type POST -body $AssignJSON
109
114
if ($ExcludeGroup) {
110
115
Write-LogMessage-headers $Headers-API $APIName-message "Assigned group '$GroupName' and excluded group '$ExcludeGroup' on Policy $PolicyId"-Sev 'Info'-tenant $TenantFilter
116
+
return"Successfully assigned group '$GroupName' and excluded group '$ExcludeGroup' on Policy $PolicyId"
111
117
} else {
112
118
Write-LogMessage-headers $Headers-API $APIName-message "Assigned group '$GroupName' on Policy $PolicyId"-Sev 'Info'-tenant $TenantFilter
119
+
return"Successfully assigned group '$GroupName' on Policy $PolicyId"
Write-LogMessage-headers $Headers-API $APIName-message "Failed to assign $GroupName to Policy $PolicyId, using Platform $PlatformType and $Type. The error is:$ErrorMessage"-Sev 'Error'-tenant $TenantFilter-LogData $ErrorMessage
126
+
return"Failed to assign $GroupName to Policy $PolicyId. Error: $ErrorMessage"
Copy file name to clipboardExpand all lines: Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardDisableGuests.ps1
+16-14Lines changed: 16 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -5,15 +5,18 @@ function Invoke-CIPPStandardDisableGuests {
5
5
.COMPONENT
6
6
(APIName) DisableGuests
7
7
.SYNOPSIS
8
-
(Label) Disable Guest accounts that have not logged on for 90 days
8
+
(Label) Disable Guest accounts that have not logged on for a number of days
9
9
.DESCRIPTION
10
-
(Helptext) Blocks login for guest users that have not logged in for 90 days
11
-
(DocsDescription) Blocks login for guest users that have not logged in for 90 days
10
+
(Helptext) Blocks login for guest users that have not logged in for a number of days
11
+
(DocsDescription) Blocks login for guest users that have not logged in for a number of days
12
12
.NOTES
13
13
CAT
14
14
Entra (AAD) Standards
15
15
TAG
16
+
EXECUTIVETEXT
17
+
Automatically disables external guest accounts that haven't been used for a number of days, reducing security risks from dormant accounts while maintaining access for active external collaborators. This helps maintain a clean user directory and reduces potential attack vectors.
16
18
ADDEDCOMPONENT
19
+
{"type":"number","name":"standards.DisableGuests.days","required":true,"defaultValue":90,"label":"Days of inactivity"}
17
20
IMPACT
18
21
Medium Impact
19
22
ADDEDDATE
@@ -31,27 +34,26 @@ function Invoke-CIPPStandardDisableGuests {
31
34
32
35
param($Tenant,$Settings)
33
36
##$Rerun -Type Standard -Tenant $Tenant -Settings $Settings 'DisableGuests'
$GraphRequest=New-GraphGetRequest-uri "https://graph.microsoft.com/beta/users?`$filter=createdDateTime le $Lookup and userType eq 'Guest' and accountEnabled eq true &`$select=id,UserPrincipalName,signInActivity,mail,userType,accountEnabled,createdDateTime,externalUserState"-scope 'https://graph.microsoft.com/.default'-tenantid $Tenant|
Write-StandardsAlert-message "Guests accounts with a login longer than 90 days ago: $($GraphRequest.count)"-object $Filtered-tenant $tenant-standardName 'DisableGuests'-standardId $Settings.standardId
75
-
Write-LogMessage-API 'Standards'-tenant $tenant-message "Guests accounts with a login longer than 90 days ago: $($GraphRequest.count)"-sev Info
77
+
Write-LogMessage-API 'Standards'-tenant $tenant-message "Guests accounts with a login longer than $($Settings.days) days ago: $($GraphRequest.count)"-sev Info
76
78
} else {
77
-
Write-LogMessage-API 'Standards'-tenant $tenant-message 'No guests accounts with a login longer than 90 days ago.'-sev Info
79
+
Write-LogMessage-API 'Standards'-tenant $tenant-message "No guests accounts with a login longer than $($Settings.days) days ago."-sev Info
0 commit comments