Skip to content

Commit

Permalink
Use Config in alerts to optionally send tenant ID if includeTenantId …
Browse files Browse the repository at this point in the history
…is true
  • Loading branch information
Yoshify committed Oct 9, 2023
1 parent 484805e commit 5bace87
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Scheduler_Alert/run.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ try {
}
$Alerts = Get-AzDataTableEntity @Table -Filter $Filter

$ConfigFilter = "RowKey eq 'CippNotifications' and PartitionKey eq 'CippNotifications'"
$Config = [pscustomobject](Get-AzDataTableEntity @Table -Filter $ConfigFilter)

$DeltaTable = Get-CIPPTable -Table DeltaCompare
$LastRunTable = Get-CIPPTable -Table AlertLastRun

Expand Down Expand Up @@ -379,7 +382,12 @@ try {

$ShippedAlerts | ForEach-Object {
if ($_ -notin $currentlog.Message) {
Write-LogMessage -message $_ -API 'Alerts' -tenant $tenant.tenant -sev Alert -tenantid $Tenant.tenantid
if ($Config.includeTenantId) {
Write-LogMessage -message $_ -API 'Alerts' -tenant $tenant.tenant -sev Alert -tenantid $Tenant.tenantid
}
else {
Write-LogMessage -message $_ -API 'Alerts' -tenant $tenant.tenant -sev Alert
}
}
}
[PSCustomObject]@{
Expand Down

0 comments on commit 5bace87

Please sign in to comment.