Skip to content

Commit b74bffe

Browse files
committed
CIPP Timers and cleanup
1 parent ef08fa3 commit b74bffe

File tree

50 files changed

+628
-638
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+628
-638
lines changed

AddChocoApp_OrchestrationStarterTimer/function.json

-15
This file was deleted.

AddChocoApp_OrchestrationStarterTimer/run.ps1

-7
This file was deleted.

BestPracticeAnalyser_OrchestrationStarterTimer/function.json

-15
This file was deleted.

BestPracticeAnalyser_OrchestrationStarterTimer/run.ps1

-3
This file was deleted.

Scheduler_GetQueue/function.json CIPPTimer/function.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
{
2+
"scriptFile": "../Modules/CippEntrypoints/CippEntrypoints.psm1",
3+
"entryPoint": "Receive-CippTimerTrigger",
24
"bindings": [
35
{
46
"name": "Timer",
5-
"schedule": "0 0 * * * *",
7+
"schedule": "0 0/15 * * * *",
68
"direction": "in",
79
"type": "timerTrigger"
810
},

CIPPTimers.json

+96
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
[
2+
{
3+
"Command": "Start-UserTasksOrchestrator",
4+
"Description": "Orchestrator to process user scheduled tasks",
5+
"Cron": "0 */15 * * * *",
6+
"Priority": 1,
7+
"RunOnProcessor": true
8+
},
9+
{
10+
"Command": "Start-AuditLogOrchestrator",
11+
"Description": "Orchestrator to process audit logs",
12+
"Cron": "0 */15 * * * *",
13+
"Priority": 2,
14+
"RunOnProcessor": true
15+
},
16+
{
17+
"Command": "Start-WebhookOrchestrator",
18+
"Description": "Orchestrator to process webhooks",
19+
"Cron": "0 */15 * * * *",
20+
"Priority": 3,
21+
"RunOnProcessor": true
22+
},
23+
{
24+
"Command": "Start-StandardsOrchestrator",
25+
"Description": "Orchestrator to process standards",
26+
"Cron": "0 0 */4 * * *",
27+
"Priority": 4,
28+
"RunOnProcessor": true
29+
},
30+
{
31+
"Command": "Start-CIPPGraphSubscriptionCleanupTimer",
32+
"Description": "Orchestrator to cleanup old Graph subscriptions",
33+
"Cron": "0 0 0 * * *",
34+
"Priority": 5,
35+
"RunOnProcessor": true
36+
},
37+
{
38+
"Command": "Start-SchedulerOrchestrator",
39+
"Description": "Orchestrator to process system scheduled tasks",
40+
"Cron": "0 0 * * * *",
41+
"Priority": 6,
42+
"RunOnProcessor": true
43+
},
44+
{
45+
"Command": "Set-CIPPGDAPInviteGroups",
46+
"Description": "Orchestrator to map the groups for GDAP invites",
47+
"Cron": "0 0 */3 * * *",
48+
"Priority": 5,
49+
"RunOnProcessor": true
50+
},
51+
{
52+
"Command": "Start-UpdateTokensTimer",
53+
"Description": "Orchestrator to update tokens",
54+
"Cron": "0 0 0 * * 0",
55+
"Priority": 7,
56+
"RunOnProcessor": true,
57+
"IsSystem": true
58+
},
59+
{
60+
"Command": "Start-CIPPGraphSubscriptionRenewalTimer",
61+
"Description": "Orchestrator to renew Graph subscriptions",
62+
"Cron": "0 10 * * * *",
63+
"Priority": 8,
64+
"RunOnProcessor": true
65+
},
66+
{
67+
"Command": "Start-DomainOrchestrator",
68+
"Description": "Orchestrator to process domains",
69+
"Cron": "0 0 0 * * *",
70+
"Priority": 10,
71+
"RunOnProcessor": true
72+
},
73+
{
74+
"Command": "Start-UpdatePermissionsOrchestrator",
75+
"Description": "Orchestrator to update CPV permissions",
76+
"Cron": "0 0 0 * * *",
77+
"Priority": 10,
78+
"RunOnProcessor": true,
79+
"IsSystem": true
80+
},
81+
{
82+
"Command": "Start-BPAOrchestrator",
83+
"Description": "Orchestrator to process BPA reports",
84+
"Cron": "0 0 3 * * *",
85+
"Priority": 10,
86+
"RunOnProcessor": true
87+
},
88+
{
89+
"Command": "Start-CIPPStatsTimer",
90+
"Description": "Timer to process CIPP stats",
91+
"Cron": "0 0 0 * * *",
92+
"Priority": 15,
93+
"RunOnProcessor": true,
94+
"IsSystem": true
95+
}
96+
]

Cleanup_OldAuditLogs/function.json

-15
This file was deleted.

Cleanup_OldAuditLogs/run.ps1

-9
This file was deleted.

Domain_OrchestrationStarterTimer/function.json

-15
This file was deleted.

Domain_OrchestrationStarterTimer/run.ps1

-8
This file was deleted.

ExecGDAPInviteApproved_Timer/function.json

-15
This file was deleted.

ExecGDAPInviteApproved_Timer/run.ps1

-5
This file was deleted.

ListGenericAllTenants/function.json

-10
This file was deleted.

ListGenericAllTenants/run.ps1

-42
This file was deleted.

Modules/CIPPCore/Public/Entrypoints/Invoke-ListMailboxStatistics.ps1

-66
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
function Start-AuditLogOrchestrator {
2+
<#
3+
.SYNOPSIS
4+
Start the Audit Log Polling Orchestrator
5+
#>
6+
[CmdletBinding(SupportsShouldProcess = $true)]
7+
param()
8+
try {
9+
$webhookTable = Get-CIPPTable -tablename webhookTable
10+
$Webhooks = Get-CIPPAzDataTableEntity @webhookTable -Filter "Version eq '3'" | Where-Object { $_.Resource -match '^Audit' -and $_.Status -ne 'Disabled' }
11+
if (($Webhooks | Measure-Object).Count -eq 0) {
12+
Write-Information 'No webhook subscriptions found. Exiting.'
13+
return
14+
}
15+
16+
$StartTime = (Get-Date).AddMinutes(-30)
17+
$EndTime = Get-Date
18+
19+
$Queue = New-CippQueueEntry -Name 'Audit Log Collection' -Reference 'AuditLogCollection' -TotalTasks ($Webhooks | Sort-Object -Property PartitionKey -Unique | Measure-Object).Count
20+
21+
$Batch = $Webhooks | Sort-Object -Property PartitionKey -Unique | Select-Object @{Name = 'TenantFilter'; Expression = { $_.PartitionKey } }, @{Name = 'QueueId'; Expression = { $Queue.RowKey } }, @{Name = 'FunctionName'; Expression = { 'AuditLogTenant' } }, @{Name = 'StartTime'; Expression = { $StartTime } }, @{Name = 'EndTime'; Expression = { $EndTime } }
22+
$InputObject = [PSCustomObject]@{
23+
OrchestratorName = 'AuditLogs'
24+
Batch = @($Batch)
25+
SkipLog = $true
26+
}
27+
if ($PSCmdlet.ShouldProcess('Start-AuditLogPolling', 'Starting Audit Log Polling')) {
28+
Start-NewOrchestration -FunctionName 'CIPPOrchestrator' -InputObject ($InputObject | ConvertTo-Json -Depth 5 -Compress)
29+
}
30+
} catch {
31+
Write-LogMessage -API 'Webhooks' -message 'Error processing webhooks' -sev Error -LogData (Get-CippException -Exception $_)
32+
Write-Information ( 'Webhook error {0} line {1} - {2}' -f $_.InvocationInfo.ScriptName, $_.InvocationInfo.ScriptLineNumber, $_.Exception.Message)
33+
}
34+
}

0 commit comments

Comments
 (0)