Skip to content

Commit c0f8e0d

Browse files
intune templates and ca templates update
1 parent 22a9593 commit c0f8e0d

File tree

2 files changed

+30
-18
lines changed

2 files changed

+30
-18
lines changed

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Conditional/Invoke-ListCAtemplates.ps1

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,23 @@ Function Invoke-ListCAtemplates {
1818
Write-Host $Request.query.id
1919
#Migrating old policies whenever you do a list
2020
$Table = Get-CippTable -tablename 'templates'
21-
22-
$Templates = Get-ChildItem 'Config\*.CATemplate.json' | ForEach-Object {
23-
$Entity = @{
24-
JSON = "$(Get-Content $_)"
25-
RowKey = "$($_.name)"
26-
PartitionKey = 'CATemplate'
27-
GUID = "$($_.name)"
21+
$Imported = Get-CIPPAzDataTableEntity @Table -Filter "PartitionKey eq 'settings'"
22+
if ($Imported.CATemplate -ne $true) {
23+
$Templates = Get-ChildItem 'Config\*.CATemplate.json' | ForEach-Object {
24+
$Entity = @{
25+
JSON = "$(Get-Content $_)"
26+
RowKey = "$($_.name)"
27+
PartitionKey = 'CATemplate'
28+
GUID = "$($_.name)"
29+
}
30+
Add-CIPPAzDataTableEntity @Table -Entity $Entity -Force
2831
}
29-
Add-CIPPAzDataTableEntity @Table -Entity $Entity -Force
32+
Add-CIPPAzDataTableEntity @Table -Entity @{
33+
CATemplate = $true
34+
RowKey = 'CATemplate'
35+
PartitionKey = 'settings'
36+
} -Force
3037
}
31-
3238
#List new policies
3339
$Table = Get-CippTable -tablename 'templates'
3440
$Filter = "PartitionKey eq 'CATemplate'"

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

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,23 @@ Function Invoke-ListIntuneTemplates {
1414
Write-LogMessage -user $request.headers.'x-ms-client-principal' -API $APINAME -message 'Accessed this API' -Sev 'Debug'
1515

1616
$Table = Get-CippTable -tablename 'templates'
17-
18-
$Templates = Get-ChildItem 'Config\*.IntuneTemplate.json' | ForEach-Object {
19-
$Entity = @{
20-
JSON = "$(Get-Content $_)"
21-
RowKey = "$($_.name)"
22-
PartitionKey = 'IntuneTemplate'
23-
GUID = "$($_.name)"
17+
$Imported = Get-CIPPAzDataTableEntity @Table -Filter "PartitionKey eq 'settings'"
18+
if ($Imported.IntuneTemplate) {
19+
$Templates = Get-ChildItem 'Config\*.IntuneTemplate.json' | ForEach-Object {
20+
$Entity = @{
21+
JSON = "$(Get-Content $_)"
22+
RowKey = "$($_.name)"
23+
PartitionKey = 'IntuneTemplate'
24+
GUID = "$($_.name)"
25+
}
26+
Add-CIPPAzDataTableEntity @Table -Entity $Entity -Force
2427
}
25-
Add-CIPPAzDataTableEntity @Table -Entity $Entity -Force
28+
Add-CIPPAzDataTableEntity @Table -Entity @{
29+
IntuneTemplate = $true
30+
RowKey = 'settings'
31+
PartitionKey = 'IntuneTemplate'
32+
} -Force
2633
}
27-
2834
#List new policies
2935
$Table = Get-CippTable -tablename 'templates'
3036
$Filter = "PartitionKey eq 'IntuneTemplate'"

0 commit comments

Comments
 (0)