Skip to content

Commit a02c796

Browse files
committed
Skip templates with empty tenant filter groups
Templates with tenant filters that resolve to no tenants (empty groups) are now skipped instead of being assigned an empty tenant list. This prevents unnecessary processing of templates that do not apply to any tenants.
1 parent 6cd233d commit a02c796

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Modules/CIPPCore/Public/Functions/Get-CIPPTenantAlignment.ps1

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,14 @@ function Get-CIPPTenantAlignment {
125125
$TenantValues.Add($filterItem.value)
126126
}
127127
}
128-
129-
if ($TenantValues -contains 'AllTenants') {
128+
`
129+
if ($TenantValues -contains 'AllTenants') {
130130
$AppliestoAllTenants = $true
131131
} elseif ($TenantValues.Count -gt 0) {
132132
$TemplateAssignedTenants = @($TenantValues)
133133
} else {
134-
$TemplateAssignedTenants = @()
134+
# Filter was specified but resolved to no tenants (empty group) - skip this template
135+
continue
135136
}
136137
} else {
137138
$AppliestoAllTenants = $true

0 commit comments

Comments
 (0)