Skip to content

Commit 2d25ff0

Browse files
authored
Merge branch 'KelvinTegelaar:master' into master
2 parents be78e9f + 80bd036 commit 2d25ff0

File tree

922 files changed

+29854
-2222
lines changed

Some content is hidden

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

922 files changed

+29854
-2222
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ ExcludedTenants
1010
SendNotifications/config.json
1111
.env
1212
Output/
13+
node_modules/.yarn-integrity
14+
yarn.lock
1315

1416
# Cursor IDE
1517
.cursor/rules

CIPPTimers.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,5 +222,23 @@
222222
"Priority": 21,
223223
"RunOnProcessor": true,
224224
"IsSystem": true
225+
},
226+
{
227+
"Id": "9a7f8e6d-5c4b-3a2d-1e0f-9b8c7d6e5f4a",
228+
"Command": "Start-CIPPDBCacheOrchestrator",
229+
"Description": "Timer to collect and cache Microsoft Graph data for all tenants",
230+
"Cron": "0 0 3 * * *",
231+
"Priority": 22,
232+
"RunOnProcessor": true,
233+
"IsSystem": true
234+
},
235+
{
236+
"Id": "1f2e3d4c-5b6a-7c8d-9e0f-1a2b3c4d5e6f",
237+
"Command": "Start-TestsOrchestrator",
238+
"Description": "Timer to run security and compliance tests against cached data",
239+
"Cron": "0 0 4 * * *",
240+
"Priority": 23,
241+
"RunOnProcessor": true,
242+
"IsSystem": true
225243
}
226244
]

Config/ExcludeSkuList.JSON

Lines changed: 28 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -3,42 +3,10 @@
33
"GUID": "90d8b3f8-712e-4f7b-aa1e-62e7ae6cbe96",
44
"Product_Display_Name": "Business Apps (free)"
55
},
6-
{
7-
"GUID": "90d8b3f8-712e-4f7b-aa1e-62e7ae6cbe96",
8-
"Product_Display_Name": "Business Apps (free)"
9-
},
10-
{
11-
"GUID": "f30db892-07e9-47e9-837c-80727f46fd3d",
12-
"Product_Display_Name": "MICROSOFT FLOW FREE"
13-
},
146
{
157
"GUID": "f30db892-07e9-47e9-837c-80727f46fd3d",
168
"Product_Display_Name": "MICROSOFT FLOW FREE"
179
},
18-
{
19-
"GUID": "f30db892-07e9-47e9-837c-80727f46fd3d",
20-
"Product_Display_Name": "MICROSOFT FLOW FREE"
21-
},
22-
{
23-
"GUID": "16ddbbfc-09ea-4de2-b1d7-312db6112d70",
24-
"Product_Display_Name": "MICROSOFT TEAMS (FREE)"
25-
},
26-
{
27-
"GUID": "16ddbbfc-09ea-4de2-b1d7-312db6112d70",
28-
"Product_Display_Name": "MICROSOFT TEAMS (FREE)"
29-
},
30-
{
31-
"GUID": "16ddbbfc-09ea-4de2-b1d7-312db6112d70",
32-
"Product_Display_Name": "MICROSOFT TEAMS (FREE)"
33-
},
34-
{
35-
"GUID": "16ddbbfc-09ea-4de2-b1d7-312db6112d70",
36-
"Product_Display_Name": "MICROSOFT TEAMS (FREE)"
37-
},
38-
{
39-
"GUID": "16ddbbfc-09ea-4de2-b1d7-312db6112d70",
40-
"Product_Display_Name": "MICROSOFT TEAMS (FREE)"
41-
},
4210
{
4311
"GUID": "16ddbbfc-09ea-4de2-b1d7-312db6112d70",
4412
"Product_Display_Name": "MICROSOFT TEAMS (FREE)"
@@ -47,10 +15,6 @@
4715
"GUID": "a403ebcc-fae0-4ca2-8c8c-7a907fd6c235",
4816
"Product_Display_Name": "Power BI (free)"
4917
},
50-
{
51-
"GUID": "a403ebcc-fae0-4ca2-8c8c-7a907fd6c235",
52-
"Product_Display_Name": "Power BI (free)"
53-
},
5418
{
5519
"GUID": "61e6bd70-fbdb-4deb-82ea-912842f39431",
5620
"Product_Display_Name": "Dynamics 365 Customer Service Insights Trial"
@@ -59,26 +23,6 @@
5923
"GUID": "bc946dac-7877-4271-b2f7-99d2db13cd2c",
6024
"Product_Display_Name": "Dynamics 365 Customer Voice Trial"
6125
},
62-
{
63-
"GUID": "bc946dac-7877-4271-b2f7-99d2db13cd2c",
64-
"Product_Display_Name": "Dynamics 365 Customer Voice Trial"
65-
},
66-
{
67-
"GUID": "bc946dac-7877-4271-b2f7-99d2db13cd2c",
68-
"Product_Display_Name": "Dynamics 365 Customer Voice Trial"
69-
},
70-
{
71-
"GUID": "bc946dac-7877-4271-b2f7-99d2db13cd2c",
72-
"Product_Display_Name": "Dynamics 365 Customer Voice Trial"
73-
},
74-
{
75-
"GUID": "bc946dac-7877-4271-b2f7-99d2db13cd2c",
76-
"Product_Display_Name": "Dynamics 365 Customer Voice Trial"
77-
},
78-
{
79-
"GUID": "338148b6-1b11-4102-afb9-f92b6cdc0f8d",
80-
"Product_Display_Name": "DYNAMICS 365 P1 TRIAL FOR INFORMATION WORKERS"
81-
},
8226
{
8327
"GUID": "338148b6-1b11-4102-afb9-f92b6cdc0f8d",
8428
"Product_Display_Name": "DYNAMICS 365 P1 TRIAL FOR INFORMATION WORKERS"
@@ -87,26 +31,6 @@
8731
"GUID": "fcecd1f9-a91e-488d-a918-a96cdb6ce2b0",
8832
"Product_Display_Name": "Microsoft Dynamics AX7 User Trial"
8933
},
90-
{
91-
"GUID": "fcecd1f9-a91e-488d-a918-a96cdb6ce2b0",
92-
"Product_Display_Name": "Microsoft Dynamics AX7 User Trial"
93-
},
94-
{
95-
"GUID": "dcb1a3ae-b33f-4487-846a-a640262fadf4",
96-
"Product_Display_Name": "Microsoft Power Apps Plan 2 Trial"
97-
},
98-
{
99-
"GUID": "dcb1a3ae-b33f-4487-846a-a640262fadf4",
100-
"Product_Display_Name": "Microsoft Power Apps Plan 2 Trial"
101-
},
102-
{
103-
"GUID": "dcb1a3ae-b33f-4487-846a-a640262fadf4",
104-
"Product_Display_Name": "Microsoft Power Apps Plan 2 Trial"
105-
},
106-
{
107-
"GUID": "dcb1a3ae-b33f-4487-846a-a640262fadf4",
108-
"Product_Display_Name": "Microsoft Power Apps Plan 2 Trial"
109-
},
11034
{
11135
"GUID": "dcb1a3ae-b33f-4487-846a-a640262fadf4",
11236
"Product_Display_Name": "Microsoft Power Apps Plan 2 Trial"
@@ -116,71 +40,59 @@
11640
"Product_Display_Name": "Microsoft Teams Trial"
11741
},
11842
{
119-
"GUID": "74fbf1bb-47c6-4796-9623-77dc7371723b",
120-
"Product_Display_Name": "Microsoft Teams Trial"
121-
},
122-
{
123-
"GUID": "74fbf1bb-47c6-4796-9623-77dc7371723b",
124-
"Product_Display_Name": "Microsoft Teams Trial"
125-
},
126-
{
127-
"GUID": "74fbf1bb-47c6-4796-9623-77dc7371723b",
128-
"Product_Display_Name": "Microsoft Teams Trial"
129-
},
130-
{
131-
"GUID": "74fbf1bb-47c6-4796-9623-77dc7371723b",
132-
"Product_Display_Name": "Microsoft Teams Trial"
43+
"GUID": "606b54a9-78d8-4298-ad8b-df6ef4481c80",
44+
"Product_Display_Name": "Power Virtual Agents Viral Trial"
13345
},
13446
{
135-
"GUID": "74fbf1bb-47c6-4796-9623-77dc7371723b",
136-
"Product_Display_Name": "Microsoft Teams Trial"
47+
"GUID": "1f2f344a-700d-42c9-9427-5cea1d5d7ba6",
48+
"Product_Display_Name": "MICROSOFT STREAM"
13749
},
13850
{
139-
"GUID": "74fbf1bb-47c6-4796-9623-77dc7371723b",
140-
"Product_Display_Name": "Microsoft Teams Trial"
51+
"GUID": "6470687e-a428-4b7a-bef2-8a291ad947c9",
52+
"Product_Display_Name": "WINDOWS STORE FOR BUSINESS"
14153
},
14254
{
143-
"GUID": "74fbf1bb-47c6-4796-9623-77dc7371723b",
144-
"Product_Display_Name": "Microsoft Teams Trial"
55+
"GUID": "710779e8-3d4a-4c88-adb9-386c958d1fdf",
56+
"Product_Display_Name": "MICROSOFT TEAMS EXPLORATORY"
14557
},
14658
{
147-
"GUID": "74fbf1bb-47c6-4796-9623-77dc7371723b",
148-
"Product_Display_Name": "Microsoft Teams Trial"
59+
"GUID": "8c4ce438-32a7-4ac5-91a6-e22ae08d9c8b",
60+
"Product_Display_Name": "Rights Management Adhoc"
14961
},
15062
{
151-
"GUID": "74fbf1bb-47c6-4796-9623-77dc7371723b",
152-
"Product_Display_Name": "Microsoft Teams Trial"
63+
"GUID": "5b631642-bd26-49fe-bd20-1daaa972ef80",
64+
"Product_Display_Name": "Microsoft Power Apps for Developer"
15365
},
15466
{
155-
"GUID": "606b54a9-78d8-4298-ad8b-df6ef4481c80",
156-
"Product_Display_Name": "Power Virtual Agents Viral Trial"
67+
"GUID": "6a4a1628-9b9a-424d-bed5-4118f0ede3fd",
68+
"Product_Display_Name": "Dynamics 365 Business Central for IWs"
15769
},
15870
{
159-
"GUID": "606b54a9-78d8-4298-ad8b-df6ef4481c80",
160-
"Product_Display_Name": "Power Virtual Agents Viral Trial"
71+
"GUID": "6ec92958-3cc1-49db-95bd-bc6b3798df71",
72+
"Product_Display_Name": "Dynamics 365 Sales Premium Viral Trial"
16173
},
16274
{
163-
"GUID": "606b54a9-78d8-4298-ad8b-df6ef4481c80",
164-
"Product_Display_Name": "Power Virtual Agents Viral Trial"
75+
"GUID": "3f9f06f5-3c31-472c-985f-62d9c10ec167",
76+
"Product_Display_Name": "Power Pages vTrial for Makers"
16577
},
16678
{
167-
"GUID": "1f2f344a-700d-42c9-9427-5cea1d5d7ba6",
168-
"Product_Display_Name": "MICROSOFT STREAM"
79+
"GUID": "9c7bff7a-3715-4da7-88d3-07f57f8d0fb6",
80+
"Product_Display_Name": "Dynamics 365 For Sales Professional Trial"
16981
},
17082
{
171-
"GUID": "1f2f344a-700d-42c9-9427-5cea1d5d7ba6",
172-
"Product_Display_Name": "MICROSOFT STREAM"
83+
"GUID": "8f0c5670-4e56-4892-b06d-91c085d7004f",
84+
"Product_Display_Name": "App Connect IW"
17385
},
17486
{
175-
"GUID": "6470687e-a428-4b7a-bef2-8a291ad947c9",
176-
"Product_Display_Name": "WINDOWS STORE FOR BUSINESS"
87+
"GUID": "87bbbc60-4754-4998-8c88-227dca264858",
88+
"Product_Display_Name": "Power Apps and Logic Flows"
17789
},
17890
{
179-
"GUID": "6470687e-a428-4b7a-bef2-8a291ad947c9",
180-
"Product_Display_Name": "WINDOWS STORE FOR BUSINESS"
91+
"GUID": "e5788282-6381-469f-84f0-3d7d4021d34d",
92+
"Product_Display_Name": "Office 365 Extra File Storage for GCC"
18193
},
18294
{
183-
"GUID": "710779e8-3d4a-4c88-adb9-386c958d1fdf",
184-
"Product_Display_Name": "MICROSOFT TEAMS EXPLORATORY"
95+
"GUID": "99049c9c-6011-4908-bf17-15f496e6519d",
96+
"Product_Display_Name": "Office 365 Extra File Storage"
18597
}
18698
]

ExampleReportTemplate.ps1

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
$Table = Get-CippTable -tablename 'CippReportTemplates'
2+
3+
# Dynamically discover all ZTNA test files
4+
$TestFiles = Get-ChildItem "C:\Github\CIPP-API\Modules\CIPPCore\Public\Tests\Invoke-CippTestZTNA*.ps1" | Sort-Object Name
5+
$AllTestIds = $TestFiles.BaseName | ForEach-Object { $_ -replace 'Invoke-CippTestZTNA', 'ZTNA' }
6+
7+
Write-Host "Discovered $($AllTestIds.Count) ZTNA tests"
8+
9+
$Entity = @{
10+
RowKey = 'd5d1e123-bce0-482d-971f-be6ed820dd92'
11+
PartitionKey = 'ReportingTemplate'
12+
IdentityTests = [string]($AllTestIds | ConvertTo-Json -Compress)
13+
Description = 'Complete Zero Trust Network Assessment Report'
14+
Name = 'Full ZTNA Report'
15+
}
16+
17+
Add-CIPPAzDataTableEntity @Table -Entity $Entity -Force
18+
19+
Write-Host "Report template created successfully with ID: $($Entity.RowKey)"
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
function Add-CIPPDbItem {
2+
<#
3+
.SYNOPSIS
4+
Add items to the CIPP Reporting database
5+
6+
.DESCRIPTION
7+
Adds items to the CippReportingDB table with support for bulk inserts and count mode
8+
9+
.PARAMETER TenantFilter
10+
The tenant domain or GUID (used as partition key)
11+
12+
.PARAMETER Type
13+
The type of data being stored (used in row key)
14+
15+
.PARAMETER Data
16+
Array of items to add to the database
17+
18+
.PARAMETER Count
19+
If specified, stores a single row with count of each object property as separate properties
20+
21+
.EXAMPLE
22+
Add-CIPPDbItem -TenantFilter 'contoso.onmicrosoft.com' -Type 'Groups' -Data $GroupsData
23+
24+
.EXAMPLE
25+
Add-CIPPDbItem -TenantFilter 'contoso.onmicrosoft.com' -Type 'Groups' -Data $GroupsData -Count
26+
#>
27+
[CmdletBinding()]
28+
param(
29+
[Parameter(Mandatory = $true)]
30+
[string]$TenantFilter,
31+
32+
[Parameter(Mandatory = $true)]
33+
[string]$Type,
34+
35+
[Parameter(Mandatory = $true)]
36+
[AllowEmptyCollection()]
37+
[array]$Data,
38+
39+
[Parameter(Mandatory = $false)]
40+
[switch]$Count
41+
)
42+
43+
try {
44+
$Table = Get-CippTable -tablename 'CippReportingDB'
45+
46+
# Helper function to format RowKey values by removing disallowed characters
47+
function Format-RowKey {
48+
param([string]$RowKey)
49+
50+
# Remove disallowed characters: / \ # ? and control characters (U+0000 to U+001F and U+007F to U+009F)
51+
$sanitized = $RowKey -replace '[/\\#?]', '_' -replace '[\u0000-\u001F\u007F-\u009F]', ''
52+
53+
return $sanitized
54+
}
55+
56+
if ($Count) {
57+
$Entity = @{
58+
PartitionKey = $TenantFilter
59+
RowKey = Format-RowKey "$Type-Count"
60+
DataCount = [int]$Data.Count
61+
}
62+
63+
Add-CIPPAzDataTableEntity @Table -Entity $Entity -Force | Out-Null
64+
65+
} else {
66+
#Get the existing type entries and nuke them. This ensures we don't have stale data.
67+
$Filter = "PartitionKey eq '{0}' and RowKey ge '{1}-' and RowKey lt '{1}0'" -f $TenantFilter, $Type
68+
$ExistingEntities = Get-CIPPAzDataTableEntity @Table -Filter $Filter
69+
if ($ExistingEntities) {
70+
Remove-AzDataTableEntity @Table -Entity $ExistingEntities -Force | Out-Null
71+
}
72+
$Entities = foreach ($Item in $Data) {
73+
$ItemId = $Item.id ?? $Item.ExternalDirectoryObjectId ?? $Item.Identity ?? $Item.skuId
74+
@{
75+
PartitionKey = $TenantFilter
76+
RowKey = Format-RowKey "$Type-$ItemId"
77+
Data = [string]($Item | ConvertTo-Json -Depth 10 -Compress)
78+
Type = $Type
79+
}
80+
}
81+
Add-CIPPAzDataTableEntity @Table -Entity $Entities -Force | Out-Null
82+
83+
}
84+
85+
Write-LogMessage -API 'CIPPDbItem' -tenant $TenantFilter -message "Added $($Data.Count) items of type $Type$(if ($Count) { ' (count mode)' })" -sev Debug
86+
87+
} catch {
88+
Write-LogMessage -API 'CIPPDbItem' -tenant $TenantFilter -message "Failed to add items of type $Type : $($_.Exception.Message)" -sev Error
89+
throw
90+
}
91+
}

0 commit comments

Comments
 (0)