Skip to content

Commit 69f7380

Browse files
authored
Merge pull request #420 from KelvinTegelaar/dev
[pull] dev from KelvinTegelaar:dev
2 parents b205ec1 + 573e14b commit 69f7380

File tree

4 files changed

+16
-14
lines changed

4 files changed

+16
-14
lines changed

Modules/CIPPCore/Public/Entrypoints/Activity Triggers/Push-ExecOnboardTenantQueue.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ function Push-ExecOnboardTenantQueue {
364364
$Table = Get-CippTable -tablename 'templates'
365365
$ExistingTemplates = Get-CippazDataTableEntity @Table -Filter "PartitionKey eq 'StandardsTemplateV2'" | Where-Object { $_.JSON -match 'AllTenants' }
366366
foreach ($AllTenantsTemplate in $ExistingTemplates) {
367-
$object = $AllTenantesTemplate.JSON | ConvertFrom-Json
367+
$object = $AllTenantsTemplate.JSON | ConvertFrom-Json
368368
$NewExcludedTenants = [system.collections.generic.list[object]]::new()
369369
if (!$object.excludedTenants) {
370370
$object | Add-Member -MemberType NoteProperty -Name 'excludedTenants' -Value @() -Force

Modules/CIPPCore/Public/Functions/Test-CIPPStandardLicense.ps1

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ function Test-CIPPStandardLicense {
2727
[string]$TenantFilter,
2828

2929
[Parameter(Mandatory = $true)]
30-
[string[]]$RequiredCapabilities
30+
[string[]]$RequiredCapabilities,
31+
32+
[Parameter(Mandatory = $false)]
33+
[switch]$SkipLog
3134
)
3235

3336
try {
@@ -41,16 +44,20 @@ function Test-CIPPStandardLicense {
4144
}
4245

4346
if ($Capabilities.Count -le 0) {
44-
Write-LogMessage -API 'Standards' -tenant $TenantFilter -message "Tenant does not have the required capability to run standard $StandardName`: The tenant needs one of the following service plans: $($RequiredCapabilities -join ',')" -sev Error
45-
Set-CIPPStandardsCompareField -FieldName "standards.$StandardName" -FieldValue "License Missing: This tenant is not licensed for the following capabilities: $($RequiredCapabilities -join ',')" -Tenant $TenantFilter
46-
Write-Host "Tenant does not have the required capability to run standard $StandardName - $($RequiredCapabilities -join ','). Exiting"
47+
if (!$SkipLog.IsPresent) {
48+
Write-LogMessage -API 'Standards' -tenant $TenantFilter -message "Tenant does not have the required capability to run standard $StandardName`: The tenant needs one of the following service plans: $($RequiredCapabilities -join ',')" -sev Error
49+
Set-CIPPStandardsCompareField -FieldName "standards.$StandardName" -FieldValue "License Missing: This tenant is not licensed for the following capabilities: $($RequiredCapabilities -join ',')" -Tenant $TenantFilter
50+
Write-Host "Tenant does not have the required capability to run standard $StandardName - $($RequiredCapabilities -join ','). Exiting"
51+
}
4752
return $false
4853
}
4954
Write-Host "Tenant has the required capabilities for standard $StandardName"
5055
return $true
5156
} catch {
52-
Write-LogMessage -API 'Standards' -tenant $TenantFilter -message "Error checking license capabilities for standard $StandardName`: $($_.Exception.Message)" -sev Error
53-
Set-CIPPStandardsCompareField -FieldName "standards.$StandardName" -FieldValue "License Missing: Error checking license capabilities - $($_.Exception.Message)" -Tenant $TenantFilter
57+
if (!$SkipLog.IsPresent) {
58+
Write-LogMessage -API 'Standards' -tenant $TenantFilter -message "Error checking license capabilities for standard $StandardName`: $($_.Exception.Message)" -sev Error
59+
Set-CIPPStandardsCompareField -FieldName "standards.$StandardName" -FieldValue "License Missing: Error checking license capabilities - $($_.Exception.Message)" -Tenant $TenantFilter
60+
}
5461
return $false
5562
}
5663
}

Modules/CIPPCore/Public/New-CIPPCAPolicy.ps1

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -197,12 +197,6 @@ function New-CIPPCAPolicy {
197197
$JSONObj.conditions.users.$groupType = @(Replace-GroupNameWithId -groupNames $JSONObj.conditions.users.$groupType)
198198
}
199199
}
200-
201-
if ($JSONObj.conditions.users.includeUsers.Count -eq 0) {
202-
Write-Information 'No users matched in this policy, setting to none'
203-
$JSONObj.conditions.users.includeUsers = 'none'
204-
}
205-
206200
} catch {
207201
$ErrorMessage = Get-CippException -Exception $_
208202
Write-LogMessage -API 'Standards' -tenant $tenant -message "Failed to replace displayNames for conditional access rule $($JSONObj.displayName). Error: $($ErrorMessage.NormalizedError)" -sev 'Error' -LogData $ErrorMessage

Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardConditionalAccessTemplate.ps1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ function Invoke-CIPPStandardConditionalAccessTemplate {
3232
##$Rerun -Type Standard -Tenant $Tenant -Settings $Settings 'ConditionalAccess'
3333
$Table = Get-CippTable -tablename 'templates'
3434
$TestResult = Test-CIPPStandardLicense -StandardName 'ConditionalAccessTemplate_general' -TenantFilter $Tenant -RequiredCapabilities @('AAD_PREMIUM', 'AAD_PREMIUM_P2')
35-
$TestP2 = Test-CIPPStandardLicense -StandardName 'ConditionalAccessTemplate_p2' -TenantFilter $Tenant -RequiredCapabilities @('AAD_PREMIUM_P2')
35+
$TestP2 = Test-CIPPStandardLicense -StandardName 'ConditionalAccessTemplate_p2' -TenantFilter $Tenant -RequiredCapabilities @('AAD_PREMIUM_P2') -SkipLog
3636
if ($TestResult -eq $false) {
3737
#writing to each item that the license is not present.
3838
$settings.TemplateList | ForEach-Object {
@@ -59,6 +59,7 @@ function Invoke-CIPPStandardConditionalAccessTemplate {
5959
if ($Policy.conditions.userRiskLevels.count -gt 0 -or $Policy.conditions.signInRiskLevels.count -gt 0) {
6060
if (!$TestP2) {
6161
Write-Information "Skipping policy $($Policy.displayName) as it requires AAD Premium P2 license."
62+
Set-CIPPStandardsCompareField -FieldName "standards.ConditionalAccessTemplate.$($Setting.value)" -FieldValue "Policy $($Policy.displayName) requires AAD Premium P2 license." -Tenant $Tenant
6263
continue
6364
}
6465
}

0 commit comments

Comments
 (0)