@@ -9,15 +9,6 @@ function Start-AuditLogOrchestrator {
99 $AuditLogSearchesTable = Get-CIPPTable - TableName ' AuditLogSearches'
1010 $AuditLogSearches = Get-CIPPAzDataTableEntity @AuditLogSearchesTable - Filter " CippStatus eq 'Pending'"
1111
12- $ConfigTable = Get-CippTable - TableName ' WebhookRules'
13- $ConfigEntries = Get-CIPPAzDataTableEntity @ConfigTable
14-
15- $TenantList = Get-Tenants - IncludeErrors
16- # Round time down to nearest minute
17- $Now = Get-Date
18- $StartTime = ($Now.AddSeconds (- $Now.Seconds )).AddHours(-1 )
19- $EndTime = $Now.AddSeconds (- $Now.Seconds )
20-
2112 if (($AuditLogSearches | Measure-Object ).Count -eq 0 ) {
2213 Write-Information ' No audit log searches available'
2314 } else {
@@ -33,67 +24,6 @@ function Start-AuditLogOrchestrator {
3324 Start-NewOrchestration - FunctionName ' CIPPOrchestrator' - InputObject ($InputObject | ConvertTo-Json - Depth 5 - Compress)
3425 }
3526 }
36-
37- Write-Information ' Audit Logs: Creating new searches'
38- foreach ($Tenant in $TenantList ) {
39- $Configuration = $ConfigEntries | Where-Object { ($_.Tenants -match $TenantFilter -or $_.Tenants -match ' AllTenants' ) }
40- if ($Configuration ) {
41- $ServiceFilters = $Configuration | Select-Object - Property type | Sort-Object - Property type - Unique | ForEach-Object { $_.type.split (' .' )[1 ] }
42- try {
43- $LogSearch = @ {
44- StartTime = $StartTime
45- EndTime = $EndTime
46- ServiceFilters = $ServiceFilters
47- TenantFilter = $Tenant.defaultDomainName
48- ProcessLogs = $true
49- RecordTypeFilters = @ (
50- ' exchangeAdmin' , ' azureActiveDirectory' , ' azureActiveDirectoryAccountLogon' , ' dataCenterSecurityCmdlet' ,
51- ' complianceDLPSharePoint' , ' complianceDLPExchange' , ' azureActiveDirectoryStsLogon' , ' skypeForBusinessPSTNUsage' ,
52- ' skypeForBusinessUsersBlocked' , ' securityComplianceCenterEOPCmdlet' , ' microsoftFlow' , ' aeD' , ' microsoftStream' ,
53- ' threatFinder' , ' project' , ' dataGovernance' , ' securityComplianceAlerts' , ' threatIntelligenceUrl' ,
54- ' securityComplianceInsights' , ' mipLabel' , ' workplaceAnalytics' , ' powerAppsApp' , ' powerAppsPlan' ,
55- ' threatIntelligenceAtpContent' , ' labelContentExplorer' , ' hygieneEvent' ,
56- ' dataInsightsRestApiAudit' , ' informationBarrierPolicyApplication' , ' microsoftTeamsAdmin' , ' hrSignal' ,
57- ' informationWorkerProtection' , ' campaign' , ' dlpEndpoint' , ' airInvestigation' , ' quarantine' , ' microsoftForms' ,
58- ' applicationAudit' , ' complianceSupervisionExchange' , ' customerKeyServiceEncryption' , ' officeNative' ,
59- ' mipAutoLabelSharePointItem' , ' mipAutoLabelSharePointPolicyLocation' , ' secureScore' ,
60- ' mipAutoLabelExchangeItem' , ' cortanaBriefing' , ' search' , ' wdatpAlerts' , ' powerPlatformAdminDlp' ,
61- ' powerPlatformAdminEnvironment' , ' mdatpAudit' , ' sensitivityLabelPolicyMatch' , ' sensitivityLabelAction' ,
62- ' sensitivityLabeledFileAction' , ' attackSim' , ' airManualInvestigation' , ' securityComplianceRBAC' , ' userTraining' ,
63- ' airAdminActionInvestigation' , ' mstic' , ' physicalBadgingSignal' , ' aipDiscover' , ' aipSensitivityLabelAction' ,
64- ' aipProtectionAction' , ' aipFileDeleted' , ' aipHeartBeat' , ' mcasAlerts' , ' onPremisesFileShareScannerDlp' ,
65- ' onPremisesSharePointScannerDlp' , ' exchangeSearch' , ' privacyDataMinimization' , ' labelAnalyticsAggregate' ,
66- ' myAnalyticsSettings' , ' securityComplianceUserChange' , ' complianceDLPExchangeClassification' ,
67- ' complianceDLPEndpoint' , ' mipExactDataMatch' , ' msdeResponseActions' , ' msdeGeneralSettings' , ' msdeIndicatorsSettings' ,
68- ' ms365DCustomDetection' , ' msdeRolesSettings' , ' mapgAlerts' , ' mapgPolicy' , ' mapgRemediation' ,
69- ' privacyRemediationAction' , ' privacyDigestEmail' , ' mipAutoLabelSimulationProgress' , ' mipAutoLabelSimulationCompletion' ,
70- ' mipAutoLabelProgressFeedback' , ' dlpSensitiveInformationType' , ' mipAutoLabelSimulationStatistics' ,
71- ' largeContentMetadata' , ' microsoft365Group' , ' cdpMlInferencingResult' , ' filteringMailMetadata' ,
72- ' cdpClassificationMailItem' , ' cdpClassificationDocument' , ' officeScriptsRunAction' , ' filteringPostMailDeliveryAction' ,
73- ' cdpUnifiedFeedback' , ' tenantAllowBlockList' , ' consumptionResource' , ' healthcareSignal' , ' dlpImportResult' ,
74- ' cdpCompliancePolicyExecution' , ' multiStageDisposition' , ' privacyDataMatch' , ' filteringDocMetadata' ,
75- ' filteringEmailFeatures' , ' powerBIDlp' , ' filteringUrlInfo' , ' filteringAttachmentInfo' , ' coreReportingSettings' ,
76- ' complianceConnector' , ' powerPlatformLockboxResourceAccessRequest' , ' powerPlatformLockboxResourceCommand' ,
77- ' cdpPredictiveCodingLabel' , ' cdpCompliancePolicyUserFeedback' , ' webpageActivityEndpoint' , ' omePortal' ,
78- ' cmImprovementActionChange' , ' filteringUrlClick' , ' mipLabelAnalyticsAuditRecord' , ' filteringEntityEvent' ,
79- ' filteringRuleHits' , ' filteringMailSubmission' , ' labelExplorer' , ' microsoftManagedServicePlatform' ,
80- ' powerPlatformServiceActivity' , ' scorePlatformGenericAuditRecord' , ' filteringTimeTravelDocMetadata' , ' alert' ,
81- ' alertStatus' , ' alertIncident' , ' incidentStatus' , ' case' , ' caseInvestigation' , ' recordsManagement' ,
82- ' privacyRemediation' , ' dataShareOperation' , ' cdpDlpSensitive' , ' ehrConnector' , ' filteringMailGradingResult' ,
83- ' microsoftTodoAudit' , ' timeTravelFilteringDocMetadata' , ' microsoftDefenderForIdentityAudit' ,
84- ' supervisoryReviewDayXInsight' , ' defenderExpertsforXDRAdmin' , ' cdpEdgeBlockedMessage' , ' hostedRpa' ,
85- ' cdpContentExplorerAggregateRecord' , ' cdpHygieneAttachmentInfo' , ' cdpHygieneSummary' , ' cdpPostMailDeliveryAction' ,
86- ' cdpEmailFeatures' , ' cdpHygieneUrlInfo' , ' cdpUrlClick' , ' cdpPackageManagerHygieneEvent' , ' filteringDocScan' ,
87- ' timeTravelFilteringDocScan' , ' mapgOnboard'
88- )
89- }
90- $NewSearch = New-CippAuditLogSearch @LogSearch
91- Write-Information " Created audit log search $ ( $Tenant.defaultDomainName ) - $ ( $NewSearch.displayName ) "
92- } catch {
93- Write-Information " Error creating audit log search $ ( $Tenant.defaultDomainName ) - $ ( $_.Exception.Message ) "
94- }
95- }
96- }
9727 } catch {
9828 Write-LogMessage - API ' Audit Logs' - message ' Error processing audit logs' - sev Error - LogData (Get-CippException - Exception $_ )
9929 Write-Information ( ' Audit logs error {0} line {1} - {2}' -f $_.InvocationInfo.ScriptName , $_.InvocationInfo.ScriptLineNumber , $_.Exception.Message )
0 commit comments