Skip to content

Commit

Permalink
Merge pull request #1149 from JohnDuprey/dev
Browse files Browse the repository at this point in the history
Audit log bugfixes
  • Loading branch information
JohnDuprey authored Oct 11, 2024
2 parents c58304c + 848f408 commit 0532c8b
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ function Get-CippAuditLogSearchResults {
)

process {
New-GraphGetRequest -uri ('https://graph.microsoft.com/beta/security/auditLog/queries/{0}/records?$top=999' -f $QueryId) -AsApp $true -tenantid $TenantFilter
New-GraphGetRequest -uri ('https://graph.microsoft.com/beta/security/auditLog/queries/{0}/records?$top=999' -f $QueryId) -AsApp $true -tenantid $TenantFilter -ErrorAction Stop
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ function Invoke-ListAuditLogSearches {
} | ConvertTo-Json -Depth 10 -Compress
}
'SearchResults' {
$Results = Get-CippAuditLogSearchResults -TenantFilter $Request.Query.TenantFilter -QueryId $Request.Query.SearchId
try {
$Results = Get-CippAuditLogSearchResults -TenantFilter $Request.Query.TenantFilter -QueryId $Request.Query.SearchId
} catch {
$Results = @{ Error = $_.Exception.Message }
}
$Body = @{
Results = @($Results)
Metadata = @{
Expand Down
8 changes: 7 additions & 1 deletion Modules/CIPPCore/Public/Webhooks/Test-CIPPAuditLogRules.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,13 @@ function Test-CIPPAuditLogRules {
}
}
#write-warning 'Getting audit records from Graph API'
$SearchResults = Get-CippAuditLogSearchResults -TenantFilter $TenantFilter -QueryId $SearchId
try {
$SearchResults = Get-CippAuditLogSearchResults -TenantFilter $TenantFilter -QueryId $SearchId
} catch {
Write-Warning "Error getting audit logs: $($_.Exception.Message)"
Write-LogMessage -API 'Webhooks' -message "Error getting audit logs for search $($SearchId)" -LogData (Get-CippException -Exception $_) -sev Error -tenant $TenantFilter
throw $_
}
$LogCount = ($SearchResults | Measure-Object).Count
$RunGuid = New-Guid
Write-Warning "Logs to process: $LogCount - RunGuid: $($RunGuid) - $($TenantFilter)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,11 +311,11 @@ function Invoke-NinjaOneTenantSync {
method = 'GET'
url = '/deviceManagement/deviceCompliancePolicies/'
},
@{
<#@{
id = 'DeviceApps'
method = 'GET'
url = '/deviceAppManagement/mobileApps'
},
},#>
@{
id = 'Groups'
method = 'GET'
Expand Down

0 comments on commit 0532c8b

Please sign in to comment.