Skip to content

Commit 0f151cf

Browse files
authored
Merge pull request #440 from KelvinTegelaar/dev
[pull] dev from KelvinTegelaar:dev
2 parents ea8376d + eff059a commit 0f151cf

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
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/Get-Tenants.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ function Get-Tenants {
4242
$IncludedTenantFilter = [scriptblock]::Create("`$_.customerId -eq '$TenantFilter'")
4343
$RelationshipFilter = " and customer/tenantId eq '$TenantFilter'"
4444
} else {
45-
$Filter = "{0} and defaultDomainName eq '{1}'" -f $Filter, $TenantFilter
46-
$IncludedTenantFilter = [scriptblock]::Create("`$_.defaultDomainName -eq '$TenantFilter'")
45+
$Filter = "{0} and defaultDomainName eq '{1}' or initialDomainName eq '{1}'" -f $Filter, $TenantFilter
46+
$IncludedTenantFilter = [scriptblock]::Create("`$_.defaultDomainName -eq '$TenantFilter' -or `$_.initialDomainName -eq '$TenantFilter'")
4747
$RelationshipFilter = ''
4848
}
4949
} else {

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)