Skip to content

Commit 0532c8b

Browse files
authored
Merge pull request KelvinTegelaar#1149 from JohnDuprey/dev
Audit log bugfixes
2 parents c58304c + 848f408 commit 0532c8b

File tree

4 files changed

+15
-5
lines changed

4 files changed

+15
-5
lines changed

Modules/CIPPCore/Public/AuditLogs/Get-CippAuditLogSearchResults.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ function Get-CippAuditLogSearchResults {
1818
)
1919

2020
process {
21-
New-GraphGetRequest -uri ('https://graph.microsoft.com/beta/security/auditLog/queries/{0}/records?$top=999' -f $QueryId) -AsApp $true -tenantid $TenantFilter
21+
New-GraphGetRequest -uri ('https://graph.microsoft.com/beta/security/auditLog/queries/{0}/records?$top=999' -f $QueryId) -AsApp $true -tenantid $TenantFilter -ErrorAction Stop
2222
}
2323
}

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Administration/Alerts/Invoke-ListAuditLogSearches.ps1

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@ function Invoke-ListAuditLogSearches {
2020
} | ConvertTo-Json -Depth 10 -Compress
2121
}
2222
'SearchResults' {
23-
$Results = Get-CippAuditLogSearchResults -TenantFilter $Request.Query.TenantFilter -QueryId $Request.Query.SearchId
23+
try {
24+
$Results = Get-CippAuditLogSearchResults -TenantFilter $Request.Query.TenantFilter -QueryId $Request.Query.SearchId
25+
} catch {
26+
$Results = @{ Error = $_.Exception.Message }
27+
}
2428
$Body = @{
2529
Results = @($Results)
2630
Metadata = @{

Modules/CIPPCore/Public/Webhooks/Test-CIPPAuditLogRules.ps1

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,13 @@ function Test-CIPPAuditLogRules {
3535
}
3636
}
3737
#write-warning 'Getting audit records from Graph API'
38-
$SearchResults = Get-CippAuditLogSearchResults -TenantFilter $TenantFilter -QueryId $SearchId
38+
try {
39+
$SearchResults = Get-CippAuditLogSearchResults -TenantFilter $TenantFilter -QueryId $SearchId
40+
} catch {
41+
Write-Warning "Error getting audit logs: $($_.Exception.Message)"
42+
Write-LogMessage -API 'Webhooks' -message "Error getting audit logs for search $($SearchId)" -LogData (Get-CippException -Exception $_) -sev Error -tenant $TenantFilter
43+
throw $_
44+
}
3945
$LogCount = ($SearchResults | Measure-Object).Count
4046
$RunGuid = New-Guid
4147
Write-Warning "Logs to process: $LogCount - RunGuid: $($RunGuid) - $($TenantFilter)"

Modules/CippExtensions/Public/NinjaOne/Invoke-NinjaOneTenantSync.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,11 +311,11 @@ function Invoke-NinjaOneTenantSync {
311311
method = 'GET'
312312
url = '/deviceManagement/deviceCompliancePolicies/'
313313
},
314-
@{
314+
<#@{
315315
id = 'DeviceApps'
316316
method = 'GET'
317317
url = '/deviceAppManagement/mobileApps'
318-
},
318+
},#>
319319
@{
320320
id = 'Groups'
321321
method = 'GET'

0 commit comments

Comments
 (0)