diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 93317828cfe5..000000000000 --- a/.gitignore +++ /dev/null @@ -1,22 +0,0 @@ -.github/ -local.settings.json -tenants.cache.json -chocoapps.cache -*.log -.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 diff --git a/Modules/CIPPCore/Public/Entrypoints/Activity Triggers/Push-CIPPOffboardingComplete.ps1 b/Modules/CIPPCore/Public/Entrypoints/Activity Triggers/Push-CIPPOffboardingComplete.ps1 index 8d86e31a27a3..30e025a244f7 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 bdd3d2d2bf81..173d7d6e5c48 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 feafd5eae3f0..6880305d98a3 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 4d9f4f11cfdb..a7128a0ac351 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 1f8b163fe714..9d06ad0ef1f9 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 7c6acb63d582..b71f062ba6ae 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/openapi.json b/openapi.json index 194c1d67d499..f91c3a0b1b63 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": {