Skip to content

Commit 01531ac

Browse files
authored
Merge pull request KelvinTegelaar#1417 from kris6673/fix-alert-deduplication
Fix: Alert deduplication bug
2 parents a32bdf9 + 11d7a16 commit 01531ac

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
function Write-AlertTrace {
22
<#
33
.FUNCTIONALITY
4-
Internal function. Pleases most of write-alertmessage for alerting purposes
4+
Internal function. Pleases most of Write-AlertTrace for alerting purposes
55
#>
66
Param(
77
$cmdletName,
88
$data,
99
$tenantFilter
10-
)
10+
)
1111
$Table = Get-CIPPTable -tablename AlertLastRun
1212
$PartitionKey = (Get-Date -UFormat '%Y%m%d').ToString()
1313
#Get current row and compare the $logData object. If it's the same, don't write it.
1414
$Row = Get-CIPPAzDataTableEntity @table -Filter "RowKey eq '$($tenantFilter)-$($cmdletName)' and PartitionKey eq '$PartitionKey'"
1515
try {
1616
$RowData = $Row.LogData
17-
$Compare = Compare-Object $RowData ($data | ConvertTo-Json -Compress -Depth 10 | Out-String)
17+
$Compare = Compare-Object $RowData (ConvertTo-Json -InputObject $data -Compress -Depth 10 | Out-String)
1818
if ($Compare) {
19-
$LogData = ConvertTo-Json $data -Compress -Depth 10 | Out-String
19+
$LogData = ConvertTo-Json -InputObject $data -Compress -Depth 10 | Out-String
2020
$TableRow = @{
2121
'PartitionKey' = $PartitionKey
2222
'RowKey' = "$($tenantFilter)-$($cmdletName)"
@@ -27,7 +27,7 @@ function Write-AlertTrace {
2727
return $data
2828
}
2929
} catch {
30-
$LogData = ConvertTo-Json $data -Compress -Depth 10 | Out-String
30+
$LogData = ConvertTo-Json -InputObject $data -Compress -Depth 10 | Out-String
3131
$TableRow = @{
3232
'PartitionKey' = $PartitionKey
3333
'RowKey' = "$($tenantFilter)-$($cmdletName)"
@@ -38,4 +38,4 @@ function Write-AlertTrace {
3838
return $data
3939
}
4040

41-
}
41+
}

0 commit comments

Comments
 (0)