From e61f31be10393e9d4f83ef4cd30a685d4f6f6ce6 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Sun, 22 Feb 2026 03:22:53 +0000
Subject: [PATCH 1/6] Initial plan
From 20721ac083ecef24597f0f4571d0d9689a02c648 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Sun, 22 Feb 2026 03:24:51 +0000
Subject: [PATCH 2/6] chore: outline plan for webhook path config support
Co-authored-by: Zacgoose <107489668+Zacgoose@users.noreply.github.com>
---
testResults.xml | 135 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 135 insertions(+)
create mode 100644 testResults.xml
diff --git a/testResults.xml b/testResults.xml
new file mode 100644
index 0000000000000..3c32a52d323bb
--- /dev/null
+++ b/testResults.xml
@@ -0,0 +1,135 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ CommandNotFoundException: The term 'Write-LogMessage' is not recognized as a name of a cmdlet, function, script file, or executable program.
+Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
+ at Get-CIPPAlertGlobalAdminAllowList, /home/runner/work/CIPP-API/CIPP-API/Modules/CIPPCore/Public/Alerts/Get-CIPPAlertGlobalAdminAllowList.ps1:82
+at <ScriptBlock>, /home/runner/work/CIPP-API/CIPP-API/Tests/Alerts/Get-CIPPAlertGlobalAdminAllowList.Tests.ps1:100
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ CommandNotFoundException: The term 'Write-LogMessage' is not recognized as a name of a cmdlet, function, script file, or executable program.
+Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
+ at Get-CIPPAlertIntunePolicyConflicts, /home/runner/work/CIPP-API/CIPP-API/Modules/CIPPCore/Public/Alerts/Get-CIPPAlertIntunePolicyConflicts.ps1:93
+at <ScriptBlock>, /home/runner/work/CIPP-API/CIPP-API/Tests/Alerts/Get-CIPPAlertIntunePolicyConflicts.Tests.ps1:149
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Expected a collection with size 1, but got collection with size 2 @(@{displayName=A; description=Entity desc; GUID=a-guid; RawJSON={"displayName":"A"}; isSynced=False}, @{displayName=B; description=B desc; GUID=b-guid; RawJSON={"b":1}; isSynced=True}).
+ at $response.Body | Should -HaveCount 1, /home/runner/work/CIPP-API/CIPP-API/Tests/Endpoint/Invoke-ListIntuneReusableSettingTemplates.Tests.ps1:63
+at <ScriptBlock>, /home/runner/work/CIPP-API/CIPP-API/Tests/Endpoint/Invoke-ListIntuneReusableSettingTemplates.Tests.ps1:63
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
From 6c9a5252758e7c2a87338820c2e33f7fca2d3e8f Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Sun, 22 Feb 2026 03:27:09 +0000
Subject: [PATCH 3/6] feat: add scoped offboarding and drift webhook
configuration
Co-authored-by: Zacgoose <107489668+Zacgoose@users.noreply.github.com>
---
.gitignore | 1 +
.../Push-CIPPOffboardingComplete.ps1 | 2 +-
.../Standards/Push-CIPPDriftManagement.ps1 | 4 +-
.../Invoke-ExecNotificationConfig.ps1 | 2 +
.../Invoke-ListNotificationConfig.ps1 | 2 +-
.../Public/Send-CIPPScheduledTaskAlert.ps1 | 8 +-
.../Public/Set-CIPPNotificationConfig.ps1 | 4 +
.../NotificationWebhookRouting.Tests.ps1 | 53 +++++++
openapi.json | 16 +++
testResults.xml | 135 ------------------
10 files changed, 88 insertions(+), 139 deletions(-)
create mode 100644 Tests/Endpoint/NotificationWebhookRouting.Tests.ps1
delete mode 100644 testResults.xml
diff --git a/.gitignore b/.gitignore
index 93317828cfe53..c4f153c8c829c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,6 +3,7 @@ local.settings.json
tenants.cache.json
chocoapps.cache
*.log
+testResults.xml
.vscode/
Cache_*
Logs
diff --git a/Modules/CIPPCore/Public/Entrypoints/Activity Triggers/Push-CIPPOffboardingComplete.ps1 b/Modules/CIPPCore/Public/Entrypoints/Activity Triggers/Push-CIPPOffboardingComplete.ps1
index 8d86e31a27a34..30e025a244f7d 100644
--- a/Modules/CIPPCore/Public/Entrypoints/Activity Triggers/Push-CIPPOffboardingComplete.ps1
+++ b/Modules/CIPPCore/Public/Entrypoints/Activity Triggers/Push-CIPPOffboardingComplete.ps1
@@ -106,7 +106,7 @@ function Push-CIPPOffboardingComplete {
# Send post-execution alerts if configured
if ($TaskInfo.PostExecution -and $ProcessedResults) {
- Send-CIPPScheduledTaskAlert -Results $ProcessedResults -TaskInfo $TaskInfo -TenantFilter $TenantFilter
+ Send-CIPPScheduledTaskAlert -Results $ProcessedResults -TaskInfo $TaskInfo -TenantFilter $TenantFilter -TaskType 'Offboarding'
}
}
diff --git a/Modules/CIPPCore/Public/Entrypoints/Activity Triggers/Standards/Push-CIPPDriftManagement.ps1 b/Modules/CIPPCore/Public/Entrypoints/Activity Triggers/Standards/Push-CIPPDriftManagement.ps1
index bdd3d2d2bf816..173d7d6e5c480 100644
--- a/Modules/CIPPCore/Public/Entrypoints/Activity Triggers/Standards/Push-CIPPDriftManagement.ps1
+++ b/Modules/CIPPCore/Public/Entrypoints/Activity Triggers/Standards/Push-CIPPDriftManagement.ps1
@@ -14,7 +14,9 @@ function Push-CippDriftManagement {
if ($Drift.newDeviationsCount -gt 0) {
$Settings = $Drift.driftSettings
$email = $Settings.driftAlertEmail
- $webhook = $Settings.driftAlertWebhook
+ $NotificationConfigTable = Get-CippTable -tablename SchedulerConfig
+ $NotificationConfig = Get-CIPPAzDataTableEntity @NotificationConfigTable -Filter "PartitionKey eq 'CippNotifications' and RowKey eq 'CippNotifications'"
+ $webhook = if ($NotificationConfig.driftWebhook) { $NotificationConfig.driftWebhook } else { $Settings.driftAlertWebhook }
$CippConfigTable = Get-CippTable -tablename Config
$CippConfig = Get-CIPPAzDataTableEntity @CippConfigTable -Filter "PartitionKey eq 'InstanceProperties' and RowKey eq 'CIPPURL'"
$CIPPURL = 'https://{0}' -f $CippConfig.Value
diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Settings/Invoke-ExecNotificationConfig.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Settings/Invoke-ExecNotificationConfig.ps1
index feafd5eae3f01..6880305d98a3f 100644
--- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Settings/Invoke-ExecNotificationConfig.ps1
+++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Settings/Invoke-ExecNotificationConfig.ps1
@@ -11,6 +11,8 @@ Function Invoke-ExecNotificationConfig {
$config = @{
email = $Request.body.email
webhook = $Request.body.webhook
+ offboardingWebhook = $Request.body.offboardingWebhook
+ driftWebhook = $Request.body.driftWebhook
onepertenant = $Request.body.onePerTenant
logsToInclude = $Request.body.logsToInclude
sendtoIntegration = $Request.body.sendtoIntegration
diff --git a/Modules/CIPPCore/Public/Entrypoints/Invoke-ListNotificationConfig.ps1 b/Modules/CIPPCore/Public/Entrypoints/Invoke-ListNotificationConfig.ps1
index 4d9f4f11cfdb1..a7128a0ac3514 100644
--- a/Modules/CIPPCore/Public/Entrypoints/Invoke-ListNotificationConfig.ps1
+++ b/Modules/CIPPCore/Public/Entrypoints/Invoke-ListNotificationConfig.ps1
@@ -16,7 +16,7 @@ Function Invoke-ListNotificationConfig {
$Config = @{}
}
#$config | Add-Member -NotePropertyValue @() -NotePropertyName 'logsToInclude' -Force
- $config.logsToInclude = @(([pscustomobject]$config | Select-Object * -ExcludeProperty schedule, type, tenantid, onepertenant, sendtoIntegration, partitionkey, rowkey, tenant, ETag, email, logsToInclude, Severity, Alert, Info, Error, timestamp, webhook, includeTenantId).psobject.properties.name)
+ $config.logsToInclude = @(([pscustomobject]$config | Select-Object * -ExcludeProperty schedule, type, tenantid, onepertenant, sendtoIntegration, partitionkey, rowkey, tenant, ETag, email, logsToInclude, Severity, Alert, Info, Error, timestamp, webhook, offboardingWebhook, driftWebhook, includeTenantId).psobject.properties.name)
if (!$config.logsToInclude) {
$config.logsToInclude = @('None')
}
diff --git a/Modules/CIPPCore/Public/Send-CIPPScheduledTaskAlert.ps1 b/Modules/CIPPCore/Public/Send-CIPPScheduledTaskAlert.ps1
index 1f8b163fe7149..9d06ad0ef1f95 100644
--- a/Modules/CIPPCore/Public/Send-CIPPScheduledTaskAlert.ps1
+++ b/Modules/CIPPCore/Public/Send-CIPPScheduledTaskAlert.ps1
@@ -80,6 +80,12 @@ function Send-CIPPScheduledTaskAlert {
Send-CIPPAlert -Type 'email' -Title $title -HTMLContent $HTML -TenantFilter $TenantFilter
}
'*webhook*' {
+ $altWebhook = $TaskInfo.PostExecution.WebhookPath
+ if (-not $altWebhook -and $TaskType -eq 'Offboarding') {
+ $NotificationConfigTable = Get-CippTable -tablename SchedulerConfig
+ $NotificationConfig = Get-CIPPAzDataTableEntity @NotificationConfigTable -Filter "PartitionKey eq 'CippNotifications' and RowKey eq 'CippNotifications'"
+ $altWebhook = $NotificationConfig.offboardingWebhook
+ }
$Webhook = [PSCustomObject]@{
'tenantId' = $TenantInfo.customerId
'Tenant' = $TenantFilter
@@ -87,7 +93,7 @@ function Send-CIPPScheduledTaskAlert {
'Results' = $Results
'AlertComment' = $TaskInfo.AlertComment
}
- Send-CIPPAlert -Type 'webhook' -Title $title -TenantFilter $TenantFilter -JSONContent $($Webhook | ConvertTo-Json -Depth 20)
+ Send-CIPPAlert -Type 'webhook' -Title $title -TenantFilter $TenantFilter -JSONContent $($Webhook | ConvertTo-Json -Depth 20) -altWebhook $altWebhook
}
}
diff --git a/Modules/CIPPCore/Public/Set-CIPPNotificationConfig.ps1 b/Modules/CIPPCore/Public/Set-CIPPNotificationConfig.ps1
index 7c6acb63d5826..b71f062ba6ae3 100644
--- a/Modules/CIPPCore/Public/Set-CIPPNotificationConfig.ps1
+++ b/Modules/CIPPCore/Public/Set-CIPPNotificationConfig.ps1
@@ -3,6 +3,8 @@ function Set-CIPPNotificationConfig {
param (
$email,
$webhook,
+ $offboardingWebhook,
+ $driftWebhook,
$onepertenant,
$logsToInclude,
$sendtoIntegration,
@@ -20,6 +22,8 @@ function Set-CIPPNotificationConfig {
'Severity' = [string]$sev
'email' = "$($email)"
'webhook' = "$($webhook)"
+ 'offboardingWebhook' = "$($offboardingWebhook)"
+ 'driftWebhook' = "$($driftWebhook)"
'onePerTenant' = [boolean]$onePerTenant
'sendtoIntegration' = [boolean]$sendtoIntegration
'includeTenantId' = $true
diff --git a/Tests/Endpoint/NotificationWebhookRouting.Tests.ps1 b/Tests/Endpoint/NotificationWebhookRouting.Tests.ps1
new file mode 100644
index 0000000000000..c9f5210c12ad4
--- /dev/null
+++ b/Tests/Endpoint/NotificationWebhookRouting.Tests.ps1
@@ -0,0 +1,53 @@
+# Pester tests for notification webhook routing configuration
+
+BeforeAll {
+ $RepoRoot = Split-Path -Parent (Split-Path -Parent (Split-Path -Parent $PSCommandPath))
+ $SetConfigPath = Join-Path $RepoRoot 'Modules/CIPPCore/Public/Set-CIPPNotificationConfig.ps1'
+ $ScheduledAlertPath = Join-Path $RepoRoot 'Modules/CIPPCore/Public/Send-CIPPScheduledTaskAlert.ps1'
+
+ function Get-CippTable { param($tablename) @{ TableName = $tablename } }
+ function Add-CIPPAzDataTableEntity { param($Entity, [switch]$Force) $script:lastEntity = $Entity }
+ function Get-Tenants { param($TenantFilter) [pscustomobject]@{ customerId = 'tenant-id' } }
+ function Get-CIPPTextReplacement { param($Text, $TenantFilter) $Text }
+ function Send-CIPPAlert { param($Type, $Title, $HTMLContent, $TenantFilter, $JSONContent, $altWebhook) $script:lastAlert = @{ Type = $Type; altWebhook = $altWebhook } }
+ function Write-LogMessage { param() }
+
+ . $SetConfigPath
+ . $ScheduledAlertPath
+}
+
+Describe 'Notification webhook routing' {
+ BeforeEach {
+ $script:lastEntity = $null
+ $script:lastAlert = $null
+ }
+
+ It 'stores scoped webhook settings in notification config' {
+ $result = Set-CIPPNotificationConfig -email 'ops@contoso.com' -webhook 'https://default.example/webhook' -offboardingWebhook 'https://default.example/offboarding' -driftWebhook 'https://default.example/drift' -onepertenant $true -logsToInclude @(@{ value = 'Warning' }) -sendtoIntegration $false -sev 'Alert'
+
+ $result | Should -Be 'Successfully set the configuration'
+ $script:lastEntity.webhook | Should -Be 'https://default.example/webhook'
+ $script:lastEntity.offboardingWebhook | Should -Be 'https://default.example/offboarding'
+ $script:lastEntity.driftWebhook | Should -Be 'https://default.example/drift'
+ }
+
+ It 'uses offboarding webhook override for offboarding task alerts' {
+ function Get-CIPPAzDataTableEntity {
+ param($Filter)
+ if ($Filter -eq "PartitionKey eq 'CippNotifications' and RowKey eq 'CippNotifications'") {
+ return [pscustomobject]@{ offboardingWebhook = 'https://default.example/offboarding' }
+ }
+ return $null
+ }
+
+ $taskInfo = [pscustomobject]@{
+ Name = 'Offboarding: user@contoso.com'
+ PostExecution = 'webhook'
+ }
+
+ Send-CIPPScheduledTaskAlert -Results @(@{ Results = 'Done' }) -TaskInfo $taskInfo -TenantFilter 'contoso.onmicrosoft.com' -TaskType 'Offboarding'
+
+ $script:lastAlert.Type | Should -Be 'webhook'
+ $script:lastAlert.altWebhook | Should -Be 'https://default.example/offboarding'
+ }
+}
diff --git a/openapi.json b/openapi.json
index 194c1d67d4997..f91c3a0b1b63d 100644
--- a/openapi.json
+++ b/openapi.json
@@ -5791,6 +5791,22 @@
"name": "Webhook",
"in": "body"
},
+ {
+ "required": false,
+ "schema": {
+ "type": "string"
+ },
+ "name": "offboardingWebhook",
+ "in": "body"
+ },
+ {
+ "required": false,
+ "schema": {
+ "type": "string"
+ },
+ "name": "driftWebhook",
+ "in": "body"
+ },
{
"required": true,
"schema": {
diff --git a/testResults.xml b/testResults.xml
deleted file mode 100644
index 3c32a52d323bb..0000000000000
--- a/testResults.xml
+++ /dev/null
@@ -1,135 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- CommandNotFoundException: The term 'Write-LogMessage' is not recognized as a name of a cmdlet, function, script file, or executable program.
-Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
- at Get-CIPPAlertGlobalAdminAllowList, /home/runner/work/CIPP-API/CIPP-API/Modules/CIPPCore/Public/Alerts/Get-CIPPAlertGlobalAdminAllowList.ps1:82
-at <ScriptBlock>, /home/runner/work/CIPP-API/CIPP-API/Tests/Alerts/Get-CIPPAlertGlobalAdminAllowList.Tests.ps1:100
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- CommandNotFoundException: The term 'Write-LogMessage' is not recognized as a name of a cmdlet, function, script file, or executable program.
-Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
- at Get-CIPPAlertIntunePolicyConflicts, /home/runner/work/CIPP-API/CIPP-API/Modules/CIPPCore/Public/Alerts/Get-CIPPAlertIntunePolicyConflicts.ps1:93
-at <ScriptBlock>, /home/runner/work/CIPP-API/CIPP-API/Tests/Alerts/Get-CIPPAlertIntunePolicyConflicts.Tests.ps1:149
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Expected a collection with size 1, but got collection with size 2 @(@{displayName=A; description=Entity desc; GUID=a-guid; RawJSON={"displayName":"A"}; isSynced=False}, @{displayName=B; description=B desc; GUID=b-guid; RawJSON={"b":1}; isSynced=True}).
- at $response.Body | Should -HaveCount 1, /home/runner/work/CIPP-API/CIPP-API/Tests/Endpoint/Invoke-ListIntuneReusableSettingTemplates.Tests.ps1:63
-at <ScriptBlock>, /home/runner/work/CIPP-API/CIPP-API/Tests/Endpoint/Invoke-ListIntuneReusableSettingTemplates.Tests.ps1:63
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
From 167bf78706a320a8fa583cae9f9287b8f15c139a Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Sun, 22 Feb 2026 03:28:00 +0000
Subject: [PATCH 4/6] test: improve readability of webhook routing test input
Co-authored-by: Zacgoose <107489668+Zacgoose@users.noreply.github.com>
---
Tests/Endpoint/NotificationWebhookRouting.Tests.ps1 | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/Tests/Endpoint/NotificationWebhookRouting.Tests.ps1 b/Tests/Endpoint/NotificationWebhookRouting.Tests.ps1
index c9f5210c12ad4..6207ee85e30db 100644
--- a/Tests/Endpoint/NotificationWebhookRouting.Tests.ps1
+++ b/Tests/Endpoint/NotificationWebhookRouting.Tests.ps1
@@ -23,7 +23,15 @@ Describe 'Notification webhook routing' {
}
It 'stores scoped webhook settings in notification config' {
- $result = Set-CIPPNotificationConfig -email 'ops@contoso.com' -webhook 'https://default.example/webhook' -offboardingWebhook 'https://default.example/offboarding' -driftWebhook 'https://default.example/drift' -onepertenant $true -logsToInclude @(@{ value = 'Warning' }) -sendtoIntegration $false -sev 'Alert'
+ $result = Set-CIPPNotificationConfig `
+ -email 'ops@contoso.com' `
+ -webhook 'https://default.example/webhook' `
+ -offboardingWebhook 'https://default.example/offboarding' `
+ -driftWebhook 'https://default.example/drift' `
+ -onepertenant $true `
+ -logsToInclude @(@{ value = 'Warning' }) `
+ -sendtoIntegration $false `
+ -sev 'Alert'
$result | Should -Be 'Successfully set the configuration'
$script:lastEntity.webhook | Should -Be 'https://default.example/webhook'
From b8f25f5932e2d2d9cd446e7e163f1c3bc5987bde Mon Sep 17 00:00:00 2001
From: Zacgoose <107489668+Zacgoose@users.noreply.github.com>
Date: Sun, 22 Feb 2026 11:29:58 +0800
Subject: [PATCH 5/6] Delete .gitignore
---
.gitignore | 23 -----------------------
1 file changed, 23 deletions(-)
delete mode 100644 .gitignore
diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index c4f153c8c829c..0000000000000
--- a/.gitignore
+++ /dev/null
@@ -1,23 +0,0 @@
-.github/
-local.settings.json
-tenants.cache.json
-chocoapps.cache
-*.log
-testResults.xml
-.vscode/
-Cache_*
-Logs
-ExcludedTenants
-SendNotifications/config.json
-.env
-Output/
-node_modules/.yarn-integrity
-yarn.lock
-
-# Cursor IDE
-.cursor/rules
-.claude
-
-# Ignore all root PowerShell files except profile.ps1
-/*.ps1
-!/profile.ps1
From 2fd67c6e3f94144fb680928bc5697fcde344756c Mon Sep 17 00:00:00 2001
From: Zacgoose <107489668+Zacgoose@users.noreply.github.com>
Date: Sun, 22 Feb 2026 11:30:11 +0800
Subject: [PATCH 6/6] Delete NotificationWebhookRouting.Tests.ps1
---
.../NotificationWebhookRouting.Tests.ps1 | 61 -------------------
1 file changed, 61 deletions(-)
delete mode 100644 Tests/Endpoint/NotificationWebhookRouting.Tests.ps1
diff --git a/Tests/Endpoint/NotificationWebhookRouting.Tests.ps1 b/Tests/Endpoint/NotificationWebhookRouting.Tests.ps1
deleted file mode 100644
index 6207ee85e30db..0000000000000
--- a/Tests/Endpoint/NotificationWebhookRouting.Tests.ps1
+++ /dev/null
@@ -1,61 +0,0 @@
-# Pester tests for notification webhook routing configuration
-
-BeforeAll {
- $RepoRoot = Split-Path -Parent (Split-Path -Parent (Split-Path -Parent $PSCommandPath))
- $SetConfigPath = Join-Path $RepoRoot 'Modules/CIPPCore/Public/Set-CIPPNotificationConfig.ps1'
- $ScheduledAlertPath = Join-Path $RepoRoot 'Modules/CIPPCore/Public/Send-CIPPScheduledTaskAlert.ps1'
-
- function Get-CippTable { param($tablename) @{ TableName = $tablename } }
- function Add-CIPPAzDataTableEntity { param($Entity, [switch]$Force) $script:lastEntity = $Entity }
- function Get-Tenants { param($TenantFilter) [pscustomobject]@{ customerId = 'tenant-id' } }
- function Get-CIPPTextReplacement { param($Text, $TenantFilter) $Text }
- function Send-CIPPAlert { param($Type, $Title, $HTMLContent, $TenantFilter, $JSONContent, $altWebhook) $script:lastAlert = @{ Type = $Type; altWebhook = $altWebhook } }
- function Write-LogMessage { param() }
-
- . $SetConfigPath
- . $ScheduledAlertPath
-}
-
-Describe 'Notification webhook routing' {
- BeforeEach {
- $script:lastEntity = $null
- $script:lastAlert = $null
- }
-
- It 'stores scoped webhook settings in notification config' {
- $result = Set-CIPPNotificationConfig `
- -email 'ops@contoso.com' `
- -webhook 'https://default.example/webhook' `
- -offboardingWebhook 'https://default.example/offboarding' `
- -driftWebhook 'https://default.example/drift' `
- -onepertenant $true `
- -logsToInclude @(@{ value = 'Warning' }) `
- -sendtoIntegration $false `
- -sev 'Alert'
-
- $result | Should -Be 'Successfully set the configuration'
- $script:lastEntity.webhook | Should -Be 'https://default.example/webhook'
- $script:lastEntity.offboardingWebhook | Should -Be 'https://default.example/offboarding'
- $script:lastEntity.driftWebhook | Should -Be 'https://default.example/drift'
- }
-
- It 'uses offboarding webhook override for offboarding task alerts' {
- function Get-CIPPAzDataTableEntity {
- param($Filter)
- if ($Filter -eq "PartitionKey eq 'CippNotifications' and RowKey eq 'CippNotifications'") {
- return [pscustomobject]@{ offboardingWebhook = 'https://default.example/offboarding' }
- }
- return $null
- }
-
- $taskInfo = [pscustomobject]@{
- Name = 'Offboarding: user@contoso.com'
- PostExecution = 'webhook'
- }
-
- Send-CIPPScheduledTaskAlert -Results @(@{ Results = 'Done' }) -TaskInfo $taskInfo -TenantFilter 'contoso.onmicrosoft.com' -TaskType 'Offboarding'
-
- $script:lastAlert.Type | Should -Be 'webhook'
- $script:lastAlert.altWebhook | Should -Be 'https://default.example/offboarding'
- }
-}