Skip to content

Commit 7fe6a93

Browse files
add excludedTenants
1 parent fd20820 commit 7fe6a93

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Alerts/Invoke-AddAlert.ps1

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,17 @@ Function Invoke-AddAlert {
1414
$Tenants = $request.body.tenantFilter
1515
$Conditions = $request.body.conditions | ConvertTo-Json -Compress -Depth 10 | Out-String
1616
$TenantsJson = $Tenants | ConvertTo-Json -Compress -Depth 10 | Out-String
17+
$excludedTenantsJson = $request.body.excludedTenants | ConvertTo-Json -Compress -Depth 10 | Out-String
1718
$Actions = $request.body.actions | ConvertTo-Json -Compress -Depth 10 | Out-String
1819
$RowKey = $Request.body.RowKey ? $Request.body.RowKey : (New-Guid).ToString()
1920
$CompleteObject = @{
20-
Tenants = [string]$TenantsJson
21-
Conditions = [string]$Conditions
22-
Actions = [string]$Actions
23-
type = $request.body.logbook.value
24-
RowKey = $RowKey
25-
PartitionKey = 'Webhookv2'
21+
Tenants = [string]$TenantsJson
22+
excludedTenants = [string]$excludedTenantsJson
23+
Conditions = [string]$Conditions
24+
Actions = [string]$Actions
25+
type = $request.body.logbook.value
26+
RowKey = $RowKey
27+
PartitionKey = 'Webhookv2'
2628
}
2729
$WebhookTable = get-cipptable -TableName 'WebhookRules'
2830
Add-CIPPAzDataTableEntity @WebhookTable -Entity $CompleteObject -Force

Modules/CIPPCore/Public/Webhooks/Test-CIPPAuditLogRules.ps1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ function Test-CIPPAuditLogRules {
3434
$Configuration = $ConfigEntries | Where-Object { ($_.Tenants -match $TenantFilter -or $_.Tenants -match 'AllTenants') } | ForEach-Object {
3535
[pscustomobject]@{
3636
Tenants = ($_.Tenants | ConvertFrom-Json)
37+
Excluded = ($_.excludedTenants | ConvertFrom-Json -ErrorAction SilentlyContinue)
3738
Conditions = $_.Conditions
3839
Actions = $_.Actions
3940
LogType = $_.Type
@@ -180,6 +181,9 @@ function Test-CIPPAuditLogRules {
180181
#write-warning "Creating filters - $(($ProcessedData.operation | Sort-Object -Unique) -join ',') - $($TenantFilter)"
181182

182183
$Where = $Configuration | ForEach-Object {
184+
if ($TenantFilter -In $_.Excluded.value) {
185+
return
186+
}
183187
$conditions = $_.Conditions | ConvertFrom-Json | Where-Object { $_.Input.value -ne '' }
184188
$actions = $_.Actions
185189
$conditionStrings = [System.Collections.Generic.List[string]]::new()

0 commit comments

Comments
 (0)