Skip to content

Commit daa1ca9

Browse files
committed
handle new alert format for phishing check
1 parent 4d1e338 commit daa1ca9

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

Modules/CIPPCore/Public/Entrypoints/Invoke-PublicPhishingCheck.ps1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ function Invoke-PublicPhishingCheck {
1616

1717
if ($Request.body.Cloned -and $Tenant.customerId -eq $Request.body.TenantId) {
1818
Write-AlertMessage -message $Request.body.AlertMessage -sev 'Alert' -tenant $Request.body.TenantId
19+
} elseif ($Request.Body.source -and $Tenant) {
20+
$Message = "Alert received from $($Request.Body.source) for $($Request.body.TenantId)"
21+
Write-Information ($Request.Body | ConvertTo-Json)
22+
Write-AlertMessage -message $Message -sev 'Alert' -tenant $Tenant.customerId -LogData $Request.body
1923
}
2024

2125
# Associate values to output bindings by calling 'Push-OutputBinding'.

Modules/CIPPCore/Public/GraphHelper/Write-AlertMessage.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
function Write-AlertMessage($message, $tenant = 'None', $tenantId = $null) {
1+
function Write-AlertMessage($message, $tenant = 'None', $tenantId = $null, $LogData = @{}) {
22
<#
33
.FUNCTIONALITY
44
Internal
@@ -10,7 +10,7 @@ function Write-AlertMessage($message, $tenant = 'None', $tenantId = $null) {
1010
$ExistingMessage = Get-CIPPAzDataTableEntity @Table -Filter $Filter
1111
if (!$ExistingMessage) {
1212
Write-Host 'No duplicate message found, writing to log'
13-
Write-LogMessage -message $message -tenant $tenant -sev 'Alert' -tenantId $tenantId -API 'Alerts'
13+
Write-LogMessage -message $message -tenant $tenant -sev 'Alert' -tenantId $tenantId -API 'Alerts' -LogData $LogData
1414
} else {
1515
Write-Host 'Alerts: Duplicate entry found, not writing to log'
1616

0 commit comments

Comments
 (0)