Skip to content

Commit baef410

Browse files
authored
Merge pull request #604 from KelvinTegelaar/dev
[pull] dev from KelvinTegelaar:dev
2 parents bd78c00 + 899597c commit baef410

File tree

16 files changed

+59
-94883
lines changed

16 files changed

+59
-94883
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Logs
99
ExcludedTenants
1010
SendNotifications/config.json
1111
.env
12-
12+
Output/
1313

1414
# Cursor IDE
1515
.cursor/rules

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Groups/Invoke-ListGroupTemplates.ps1

Lines changed: 37 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -13,35 +13,44 @@ function Invoke-ListGroupTemplates {
1313
$Table = Get-CippTable -tablename 'templates'
1414
$Filter = "PartitionKey eq 'GroupTemplate'"
1515
$Templates = (Get-CIPPAzDataTableEntity @Table -Filter $Filter) | ForEach-Object {
16-
$data = $_.JSON | ConvertFrom-Json -ErrorAction SilentlyContinue
17-
# Normalize groupType to camelCase for consistent frontend handling
18-
# Handle both stored normalized values and legacy values
19-
$normalizedGroupType = switch -Wildcard ($data.groupType) {
20-
# Already normalized values (most common)
21-
'dynamicdistribution' { 'dynamicDistribution'; break }
22-
'azurerole' { 'azureRole'; break }
23-
# Legacy values that might exist in stored templates
24-
'*dynamicdistribution*' { 'dynamicDistribution'; break }
25-
'*dynamic*' { 'dynamic'; break }
26-
'*azurerole*' { 'azureRole'; break }
27-
'*unified*' { 'm365'; break }
28-
'*microsoft*' { 'm365'; break }
29-
'*m365*' { 'm365'; break }
30-
'*generic*' { 'generic'; break }
31-
'*security*' { 'security'; break }
32-
'*distribution*' { 'distribution'; break }
33-
'*mail*' { 'distribution'; break }
34-
default { $data.groupType }
35-
}
16+
try {
17+
$data = $_.JSON | ConvertFrom-Json -ErrorAction SilentlyContinue
18+
# Normalize groupType to camelCase for consistent frontend handling
19+
# Handle both stored normalized values and legacy values
20+
21+
if (!$data.groupType) {
22+
$data.groupType = 'generic'
23+
}
24+
25+
$normalizedGroupType = switch -Wildcard ($data.groupType) {
26+
# Already normalized values (most common)
27+
'dynamicdistribution' { 'dynamicDistribution'; break }
28+
'azurerole' { 'azureRole'; break }
29+
# Legacy values that might exist in stored templates
30+
'*dynamicdistribution*' { 'dynamicDistribution'; break }
31+
'*dynamic*' { 'dynamic'; break }
32+
'*azurerole*' { 'azureRole'; break }
33+
'*unified*' { 'm365'; break }
34+
'*microsoft*' { 'm365'; break }
35+
'*m365*' { 'm365'; break }
36+
'*generic*' { 'generic'; break }
37+
'*security*' { 'security'; break }
38+
'*distribution*' { 'distribution'; break }
39+
'*mail*' { 'distribution'; break }
40+
default { $data.groupType }
41+
}
3642

37-
[PSCustomObject]@{
38-
displayName = $data.displayName
39-
description = $data.description
40-
groupType = $normalizedGroupType
41-
membershipRules = $data.membershipRules
42-
allowExternal = $data.allowExternal
43-
username = $data.username
44-
GUID = $_.RowKey
43+
[PSCustomObject]@{
44+
displayName = $data.displayName
45+
description = $data.description
46+
groupType = $normalizedGroupType
47+
membershipRules = $data.membershipRules
48+
allowExternal = $data.allowExternal
49+
username = $data.username
50+
GUID = $_.RowKey
51+
}
52+
} catch {
53+
Write-Information "Could not parse group template $($_.RowKey): $($_.Exception.Message)"
4554
}
4655
} | Sort-Object -Property displayName
4756

Modules/CIPPCore/Public/Entrypoints/Orchestrator Functions/Start-AuditLogIngestion.ps1

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,9 @@ function Start-AuditLogIngestion {
1515

1616
try {
1717
Write-Information 'Office 365 Management Activity API: Starting audit log ingestion orchestrator'
18-
1918
# Get webhook rules to determine which tenants to monitor
2019
$WebhookRulesTable = Get-CippTable -TableName 'WebhookRules'
2120
$WebhookRules = Get-CIPPAzDataTableEntity @WebhookRulesTable -Filter "PartitionKey eq 'Webhookv2'"
22-
2321
if (($WebhookRules | Measure-Object).Count -eq 0) {
2422
Write-Information 'No webhook rules defined, skipping audit log ingestion'
2523
return
@@ -78,7 +76,7 @@ function Start-AuditLogIngestion {
7876
if ($PSCmdlet.ShouldProcess('Start-AuditLogIngestion', 'Starting Audit Log Ingestion')) {
7977
$Queue = New-CippQueueEntry -Name 'Audit Logs Ingestion' -Reference 'AuditLogsIngestion' -TotalTasks $TenantsToProcess.Count
8078
$Batch = $TenantsToProcess | Select-Object @{Name = 'TenantFilter'; Expression = { $_.defaultDomainName } }, @{Name = 'TenantId'; Expression = { $_.customerId } }, @{Name = 'ContentTypes'; Expression = { $_.ContentTypes } }, @{Name = 'QueueId'; Expression = { $Queue.RowKey } }, @{Name = 'FunctionName'; Expression = { 'AuditLogIngestion' } }
81-
$InputObject = [PSCustomObject]@{
79+
$InputObject = [PSCustomObject]@{
8280
OrchestratorName = 'AuditLogsIngestion'
8381
Batch = @($Batch)
8482
SkipLog = $true

Modules/CIPPCore/Public/Get-CIPPTimerFunctions.ps1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ function Get-CIPPTimerFunctions {
4040
}
4141

4242
$CIPPRoot = (Get-Item $CIPPCoreModuleRoot).Parent.Parent
43+
Write-Host "Loading CIPPTimers from $CIPPRoot\CIPPTimers.json"
4344
$CippTimers = Get-Content -Path $CIPPRoot\CIPPTimers.json
45+
Write-Host "CIPPTimers content: $CippTimers"
4446
if ($ListAllTasks) {
4547
$Orchestrators = $CippTimers | ConvertFrom-Json | Sort-Object -Property Priority
4648
} else {

Modules/CIPPCore/Public/New-CIPPIntuneTemplate.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ function New-CIPPIntuneTemplate {
5151
'configurationPolicies' {
5252
$Type = 'Catalog'
5353
$Template = New-GraphGetRequest -uri "https://graph.microsoft.com/beta/deviceManagement/$($urlname)('$($ID)')?`$expand=settings" -tenantid $TenantFilter | Select-Object name, description, settings, platforms, technologies, templateReference
54-
$TemplateJson = $Template | ConvertTo-Json -Depth 100
54+
$TemplateJson = $Template | ConvertTo-Json -Depth 100 -Compress
5555
$DisplayName = $Template.name
5656

5757
}

Modules/CippEntrypoints/CippEntrypoints.psm1

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,15 @@ function Receive-CippActivityTrigger {
278278
try {
279279
$Output = $null
280280
Set-Location (Get-Item $PSScriptRoot).Parent.Parent.FullName
281-
281+
$metric = @{
282+
Kind = 'CIPPCommandStart'
283+
Command = $Item.Command
284+
Tenant = $Item.TenantFilter.defaultDomainName
285+
TaskName = $Item.TaskName
286+
JSONData = ($Item | ConvertTo-Json -Depth 10 -Compress)
287+
} | ConvertTo-Json -Depth 10 -Compress
288+
289+
Write-Information -MessageData $metric -Tag 'CIPPCommandStart'
282290
if ($Item.QueueId) {
283291
if ($Item.QueueName) {
284292
$QueueName = $Item.QueueName
@@ -400,6 +408,7 @@ function Receive-CIPPTimerTrigger {
400408

401409
$UtcNow = (Get-Date).ToUniversalTime()
402410
$Functions = Get-CIPPTimerFunctions
411+
Write-Host "CIPP Timer Trigger executed at $UtcNow. Found $($Functions.Count) functions to evaluate. The names are as follows: $($Functions.Command -join ', ')"
403412
$Table = Get-CIPPTable -tablename CIPPTimers
404413
$Statuses = Get-CIPPAzDataTableEntity @Table
405414
$FunctionName = $env:WEBSITE_SITE_NAME

0 commit comments

Comments
 (0)