@@ -33,6 +33,12 @@ function Push-SchedulerCIPPNotifications {
3333 }
3434 Write-Information " Alerts: $ ( $Currentlog.count ) found"
3535 Write-Information " Standards: $ ( $CurrentStandardsLogs.count ) found"
36+
37+ # Get the CIPP URL
38+ $CippConfigTable = Get-CippTable - tablename Config
39+ $CippConfig = Get-CIPPAzDataTableEntity @CippConfigTable - Filter " PartitionKey eq 'InstanceProperties' and RowKey eq 'CIPPURL'"
40+ $CIPPURL = ' https://{0}' -f $CippConfig.Value
41+
3642 # email try
3743 try {
3844 if ($Config.email -like ' *@*' ) {
@@ -42,21 +48,21 @@ function Push-SchedulerCIPPNotifications {
4248 foreach ($tenant in ($CurrentLog.Tenant | Sort-Object - Unique)) {
4349 $Data = ($CurrentLog | Select-Object Message, API, Tenant, Username, Severity | Where-Object - Property tenant -EQ $tenant )
4450 $Subject = " $ ( $Tenant ) : CIPP Alert: Alerts found starting at $ ( (Get-Date ).AddMinutes(-15 )) "
45- $HTMLContent = New-CIPPAlertTemplate - Data $Data - Format ' html' - InputObject ' table'
51+ $HTMLContent = New-CIPPAlertTemplate - Data $Data - Format ' html' - InputObject ' table' - CIPPURL $CIPPURL
4652 Send-CIPPAlert - Type ' email' - Title $Subject - HTMLContent $HTMLContent.htmlcontent - TenantFilter $tenant - APIName ' Alerts'
4753 }
4854 } else {
4955 $Data = ($CurrentLog | Select-Object Message, API, Tenant, Username, Severity)
5056 $Subject = " CIPP Alert: Alerts found starting at $ ( (Get-Date ).AddMinutes(-15 )) "
51- $HTMLContent = New-CIPPAlertTemplate - Data $Data - Format ' html' - InputObject ' table'
57+ $HTMLContent = New-CIPPAlertTemplate - Data $Data - Format ' html' - InputObject ' table' - CIPPURL $CIPPURL
5258 Send-CIPPAlert - Type ' email' - Title $Subject - HTMLContent $HTMLContent.htmlcontent - TenantFilter $tenant - APIName ' Alerts'
5359 }
5460 }
5561 if ($CurrentStandardsLogs ) {
5662 foreach ($tenant in ($CurrentStandardsLogs.Tenant | Sort-Object - Unique)) {
5763 $Data = ($CurrentStandardsLogs | Where-Object - Property tenant -EQ $tenant )
5864 $Subject = " $ ( $Tenant ) : Standards are out of sync for $tenant "
59- $HTMLContent = New-CIPPAlertTemplate - Data $Data - Format ' html' - InputObject ' standards'
65+ $HTMLContent = New-CIPPAlertTemplate - Data $Data - Format ' html' - InputObject ' standards' - CIPPURL $CIPPURL
6066 Send-CIPPAlert - Type ' email' - Title $Subject - HTMLContent $HTMLContent.htmlcontent - TenantFilter $tenant - APIName ' Alerts'
6167 $updateStandards = $CurrentStandardsLogs | ForEach-Object {
6268 if ($_.PSObject.Properties.Name -contains ' sentAsAlert' ) {
@@ -87,7 +93,7 @@ function Push-SchedulerCIPPNotifications {
8793 }
8894
8995 if ($CurrentStandardsLogs ) {
90- $JSONContent = New-CIPPAlertTemplate - Data $Data - Format ' json' - InputObject ' table'
96+ $JSONContent = New-CIPPAlertTemplate - Data $Data - Format ' json' - InputObject ' table' - CIPPURL $CIPPURL
9197 $CurrentStandardsLogs | ConvertTo-Json - Compress
9298 Send-CIPPAlert - Type ' webhook' - JSONContent $JSONContent - TenantFilter $Tenant - APIName ' Alerts'
9399 $updateStandards = $CurrentStandardsLogs | ForEach-Object {
@@ -110,7 +116,7 @@ function Push-SchedulerCIPPNotifications {
110116 try {
111117 foreach ($tenant in ($CurrentLog.Tenant | Sort-Object - Unique)) {
112118 $Data = ($CurrentLog | Select-Object Message, API, Tenant, Username, Severity | Where-Object - Property tenant -EQ $tenant )
113- $HTMLContent = New-CIPPAlertTemplate - Data $Data - Format ' html' - InputObject ' table'
119+ $HTMLContent = New-CIPPAlertTemplate - Data $Data - Format ' html' - InputObject ' table' - CIPPURL $CIPPURL
114120 $Title = " $tenant CIPP Alert: Alerts found starting at $ ( (Get-Date ).AddMinutes(-15 )) "
115121 Send-CIPPAlert - Type ' psa' - Title $Title - HTMLContent $HTMLContent.htmlcontent - TenantFilter $tenant - APIName ' Alerts'
116122 $UpdateLogs = $CurrentLog | ForEach-Object { $_.SentAsAlert = $true ; $_ }
@@ -119,7 +125,7 @@ function Push-SchedulerCIPPNotifications {
119125 foreach ($standardsTenant in ($CurrentStandardsLogs.Tenant | Sort-Object - Unique)) {
120126 $Data = ($CurrentStandardsLogs | Where-Object - Property tenant -EQ $standardsTenant )
121127 $Subject = " $ ( $standardsTenant ) : Standards are out of sync for $standardsTenant "
122- $HTMLContent = New-CIPPAlertTemplate - Data $Data - Format ' html' - InputObject ' standards'
128+ $HTMLContent = New-CIPPAlertTemplate - Data $Data - Format ' html' - InputObject ' standards' - CIPPURL $CIPPURL
123129 Send-CIPPAlert - Type ' psa' - Title $Subject - HTMLContent $HTMLContent.htmlcontent - TenantFilter $standardsTenant - APIName ' Alerts'
124130 $updateStandards = $CurrentStandardsLogs | ForEach-Object {
125131 if ($_.PSObject.Properties.Name -contains ' sentAsAlert' ) {
0 commit comments