@@ -29,7 +29,7 @@ function Start-AuditLogSearchCreation {
2929
3030 Write-Information ' Audit Logs: Creating new searches'
3131
32- foreach ($Tenant in $TenantList ) {
32+ $Batch = foreach ($Tenant in $TenantList ) {
3333 Write-Information " Processing tenant $ ( $Tenant.defaultDomainName ) - $ ( $Tenant.customerId ) "
3434 $TenantInConfig = $false
3535 $MatchingConfigs = [System.Collections.Generic.List [object ]]::new()
@@ -50,64 +50,27 @@ function Start-AuditLogSearchCreation {
5050 }
5151
5252 if ($MatchingConfigs ) {
53- $ServiceFilters = $MatchingConfigs | Select-Object - Property type | Sort-Object - Property type - Unique | ForEach-Object { $_.type.split (' .' )[1 ] }
54- try {
55- $LogSearch = @ {
56- StartTime = $StartTime
57- EndTime = $EndTime
58- ServiceFilters = $ServiceFilters
59- TenantFilter = $Tenant.defaultDomainName
60- ProcessLogs = $true
61- RecordTypeFilters = @ (
62- ' exchangeAdmin' , ' azureActiveDirectory' , ' azureActiveDirectoryAccountLogon' , ' dataCenterSecurityCmdlet' ,
63- ' complianceDLPSharePoint' , ' complianceDLPExchange' , ' azureActiveDirectoryStsLogon' , ' skypeForBusinessPSTNUsage' ,
64- ' skypeForBusinessUsersBlocked' , ' securityComplianceCenterEOPCmdlet' , ' microsoftFlow' , ' aeD' , ' microsoftStream' ,
65- ' threatFinder' , ' project' , ' dataGovernance' , ' securityComplianceAlerts' , ' threatIntelligenceUrl' ,
66- ' securityComplianceInsights' , ' mipLabel' , ' workplaceAnalytics' , ' powerAppsApp' , ' powerAppsPlan' ,
67- ' threatIntelligenceAtpContent' , ' labelContentExplorer' , ' hygieneEvent' ,
68- ' dataInsightsRestApiAudit' , ' informationBarrierPolicyApplication' , ' microsoftTeamsAdmin' , ' hrSignal' ,
69- ' informationWorkerProtection' , ' campaign' , ' dlpEndpoint' , ' airInvestigation' , ' quarantine' , ' microsoftForms' ,
70- ' applicationAudit' , ' complianceSupervisionExchange' , ' customerKeyServiceEncryption' , ' officeNative' ,
71- ' mipAutoLabelSharePointItem' , ' mipAutoLabelSharePointPolicyLocation' , ' secureScore' ,
72- ' mipAutoLabelExchangeItem' , ' cortanaBriefing' , ' search' , ' wdatpAlerts' , ' powerPlatformAdminDlp' ,
73- ' powerPlatformAdminEnvironment' , ' mdatpAudit' , ' sensitivityLabelPolicyMatch' , ' sensitivityLabelAction' ,
74- ' sensitivityLabeledFileAction' , ' attackSim' , ' airManualInvestigation' , ' securityComplianceRBAC' , ' userTraining' ,
75- ' airAdminActionInvestigation' , ' mstic' , ' physicalBadgingSignal' , ' aipDiscover' , ' aipSensitivityLabelAction' ,
76- ' aipProtectionAction' , ' aipFileDeleted' , ' aipHeartBeat' , ' mcasAlerts' , ' onPremisesFileShareScannerDlp' ,
77- ' onPremisesSharePointScannerDlp' , ' exchangeSearch' , ' privacyDataMinimization' , ' labelAnalyticsAggregate' ,
78- ' myAnalyticsSettings' , ' securityComplianceUserChange' , ' complianceDLPExchangeClassification' ,
79- ' complianceDLPEndpoint' , ' mipExactDataMatch' , ' msdeResponseActions' , ' msdeGeneralSettings' , ' msdeIndicatorsSettings' ,
80- ' ms365DCustomDetection' , ' msdeRolesSettings' , ' mapgAlerts' , ' mapgPolicy' , ' mapgRemediation' ,
81- ' privacyRemediationAction' , ' privacyDigestEmail' , ' mipAutoLabelSimulationProgress' , ' mipAutoLabelSimulationCompletion' ,
82- ' mipAutoLabelProgressFeedback' , ' dlpSensitiveInformationType' , ' mipAutoLabelSimulationStatistics' ,
83- ' largeContentMetadata' , ' microsoft365Group' , ' cdpMlInferencingResult' , ' filteringMailMetadata' ,
84- ' cdpClassificationMailItem' , ' cdpClassificationDocument' , ' officeScriptsRunAction' , ' filteringPostMailDeliveryAction' ,
85- ' cdpUnifiedFeedback' , ' tenantAllowBlockList' , ' consumptionResource' , ' healthcareSignal' , ' dlpImportResult' ,
86- ' cdpCompliancePolicyExecution' , ' multiStageDisposition' , ' privacyDataMatch' , ' filteringDocMetadata' ,
87- ' filteringEmailFeatures' , ' powerBIDlp' , ' filteringUrlInfo' , ' filteringAttachmentInfo' , ' coreReportingSettings' ,
88- ' complianceConnector' , ' powerPlatformLockboxResourceAccessRequest' , ' powerPlatformLockboxResourceCommand' ,
89- ' cdpPredictiveCodingLabel' , ' cdpCompliancePolicyUserFeedback' , ' webpageActivityEndpoint' , ' omePortal' ,
90- ' cmImprovementActionChange' , ' filteringUrlClick' , ' mipLabelAnalyticsAuditRecord' , ' filteringEntityEvent' ,
91- ' filteringRuleHits' , ' filteringMailSubmission' , ' labelExplorer' , ' microsoftManagedServicePlatform' ,
92- ' powerPlatformServiceActivity' , ' scorePlatformGenericAuditRecord' , ' filteringTimeTravelDocMetadata' , ' alert' ,
93- ' alertStatus' , ' alertIncident' , ' incidentStatus' , ' case' , ' caseInvestigation' , ' recordsManagement' ,
94- ' privacyRemediation' , ' dataShareOperation' , ' cdpDlpSensitive' , ' ehrConnector' , ' filteringMailGradingResult' ,
95- ' microsoftTodoAudit' , ' timeTravelFilteringDocMetadata' , ' microsoftDefenderForIdentityAudit' ,
96- ' supervisoryReviewDayXInsight' , ' defenderExpertsforXDRAdmin' , ' cdpEdgeBlockedMessage' , ' hostedRpa' ,
97- ' cdpContentExplorerAggregateRecord' , ' cdpHygieneAttachmentInfo' , ' cdpHygieneSummary' , ' cdpPostMailDeliveryAction' ,
98- ' cdpEmailFeatures' , ' cdpHygieneUrlInfo' , ' cdpUrlClick' , ' cdpPackageManagerHygieneEvent' , ' filteringDocScan' ,
99- ' timeTravelFilteringDocScan' , ' mapgOnboard'
100- )
101- }
102- if ($PSCmdlet.ShouldProcess (' Start-AuditLogSearchCreation' , ' Creating Audit Log Search' )) {
103- $NewSearch = New-CippAuditLogSearch @LogSearch
104- Write-Information " Created audit log search $ ( $Tenant.defaultDomainName ) - $ ( $NewSearch.displayName ) "
105- }
106- } catch {
107- Write-Information " Error creating audit log search $ ( $Tenant.defaultDomainName ) - $ ( $_.Exception.Message ) "
53+ [PSCustomObject ]@ {
54+ FunctionName = ' AuditLogSearchCreation'
55+ Tenant = $Tenant | Select-Object defaultDomainName, customerId, displayName
56+ StartTime = $StartTime
57+ EndTime = $EndTime
58+ ServiceFilters = @ ($MatchingConfigs | Select-Object - Property type | Sort-Object - Property type - Unique | ForEach-Object { $_.type.split (' .' )[1 ] })
10859 }
10960 }
11061 }
62+
63+ if (($Batch | Measure-Object ).Count -gt 0 ) {
64+ $InputObject = [PSCustomObject ]@ {
65+ Batch = @ ($Batch )
66+ OrchestratorName = ' AuditLogSearchCreation'
67+ SkipLog = $true
68+ }
69+ Start-NewOrchestration - FunctionName ' CIPPOrchestrator' - InputObject ($InputObject | ConvertTo-Json - Depth 5 - Compress)
70+ Write-Information " Started Audit Log search creation orchestratorwith $ ( $Batch.Count ) tenants"
71+ } else {
72+ Write-Information ' No tenants found for Audit Log search creation'
73+ }
11174 } catch {
11275 Write-LogMessage - API ' Audit Logs' - message ' Error creating audit log searches' - sev Error - LogData (Get-CippException - Exception $_ )
11376 Write-Information ( ' Audit logs error {0} line {1} - {2}' -f $_.InvocationInfo.ScriptName , $_.InvocationInfo.ScriptLineNumber , $_.Exception.Message )
0 commit comments