File tree Expand file tree Collapse file tree 4 files changed +15
-5
lines changed
Entrypoints/HTTP Functions/Tenant/Administration/Alerts
CippExtensions/Public/NinjaOne Expand file tree Collapse file tree 4 files changed +15
-5
lines changed Original file line number Diff line number Diff 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}
Original file line number Diff line number Diff 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 = @ {
Original file line number Diff line number Diff 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 ) "
Original file line number Diff line number Diff 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'
You can’t perform that action at this time.
0 commit comments