Skip to content

Commit 5121b3c

Browse files
committed
Add CreateGroups parameter to CAPolicy creation
Introduces the CreateGroups parameter when constructing the New-CIPPCAPolicy call, allowing group creation to be specified via the request body.
1 parent a10a744 commit 5121b3c

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

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

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,24 @@ function Invoke-AddCAPolicy {
1111
$APIName = $Request.Params.CIPPEndpoint
1212
$Headers = $Request.Headers
1313

14-
1514
$Tenants = $Request.body.tenantFilter.value
1615
if ('AllTenants' -in $Tenants) { $Tenants = (Get-Tenants).defaultDomainName }
1716

1817
$results = foreach ($Tenant in $tenants) {
1918
try {
20-
$CAPolicy = New-CIPPCAPolicy -replacePattern $Request.Body.replacename -Overwrite $request.Body.overwrite -TenantFilter $Tenant -state $Request.Body.NewState -DisableSD $Request.Body.DisableSD -RawJSON $Request.Body.RawJSON -APIName $APIName -Headers $Headers
19+
$NewCAPolicy = @{
20+
replacePattern = $Request.Body.replacename
21+
Overwrite = $Request.Body.overwrite
22+
TenantFilter = $Tenant
23+
state = $Request.Body.NewState
24+
DisableSD = $Request.Body.DisableSD
25+
CreateGroups = $Request.Body.CreateGroups
26+
RawJSON = $Request.Body.RawJSON
27+
APIName = $APIName
28+
Headers = $Headers
29+
}
30+
$CAPolicy = New-CIPPCAPolicy @NewCAPolicy
31+
2132
"$CAPolicy"
2233
} catch {
2334
"$($_.Exception.Message)"

0 commit comments

Comments
 (0)