Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 0 additions & 22 deletions .gitignore

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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')
}
Expand Down
8 changes: 7 additions & 1 deletion Modules/CIPPCore/Public/Send-CIPPScheduledTaskAlert.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,20 @@ 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
'TaskInfo' = $TaskInfo
'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
}
}

Expand Down
4 changes: 4 additions & 0 deletions Modules/CIPPCore/Public/Set-CIPPNotificationConfig.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ function Set-CIPPNotificationConfig {
param (
$email,
$webhook,
$offboardingWebhook,
$driftWebhook,
$onepertenant,
$logsToInclude,
$sendtoIntegration,
Expand All @@ -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
Expand Down
16 changes: 16 additions & 0 deletions openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down