Skip to content

Commit 6cfe827

Browse files
authored
Merge pull request #98 from KelvinTegelaar/dev
[pull] dev from KelvinTegelaar:dev
2 parents b06e897 + 0fe1a3f commit 6cfe827

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

Modules/CIPPCore/Public/Set-CIPPIntunePolicy.ps1

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,22 @@ function Set-CIPPIntunePolicy {
1111
$APINAME,
1212
$tenantFilter
1313
)
14+
#connect to table, get replacement map. This is for future usage. The replacement map will allow users to create custom vars that get replaced by the actual values per tenant. Example:
15+
# %WallPaperPath% gets replaced by RowKey WallPaperPath which is set to C:\Wallpapers for tenant 1, and D:\Wallpapers for tenant 2
16+
$ReplaceTable = Get-CIPPTable -tablename 'CippReplacemap'
17+
$ReplaceMap = Get-CIPPAzDataTableEntity @ReplaceTable -Filter "PartitionKey eq '$tenantFilter'"
18+
if ($ReplaceMap) {
19+
foreach ($Replace in $ReplaceMap) {
20+
$RawJSON = $RawJSON -replace $Replace.RowKey, $Replace.Value
21+
}
22+
}
23+
#default replacements for all tenants: %tenantid% becomes $tenant.customerId, %tenantfilter% becomes $tenant.defaultDomainName, %tenantname% becomes $tenant.displayName
24+
$Tenant = Get-Tenants -TenantFilter $tenantFilter
25+
$RawJSON = $RawJSON -replace '%tenantid%', $Tenant.customerId
26+
$RawJSON = $RawJSON -replace '%tenantfilter%', $Tenant.defaultDomainName
27+
$RawJSON = $RawJSON -replace '%tenantname%', $Tenant.displayName
28+
29+
1430
try {
1531
switch ($TemplateType) {
1632
'AppProtection' {

0 commit comments

Comments
 (0)