File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Conditional Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -22,8 +22,6 @@ function Invoke-ExecCAExclusion {
2222 $PolicyId = $Request.Body.PolicyId
2323 $ExclusionType = $Request.Body.ExclusionType
2424
25- $Policy = New-GraphGetRequest - uri " https://graph.microsoft.com/beta/identity/conditionalAccess/policies/$ ( $PolicyId ) ?`$ select=id,displayName" - tenantid $TenantFilter
26-
2725 if ($Users ) {
2826 $UserID = $Users.value
2927 $Username = $Users.addedFields.userPrincipalName -join ' , '
@@ -32,6 +30,14 @@ function Invoke-ExecCAExclusion {
3230 $Username = (New-GraphGetRequest - uri " https://graph.microsoft.com/v1.0/users/$ ( $UserID ) " - tenantid $TenantFilter ).userPrincipalName
3331 }
3432 }
33+
34+ $Policy = New-GraphGetRequest - uri " https://graph.microsoft.com/beta/identity/conditionalAccess/policies/$ ( $PolicyId ) ?`$ select=id,displayName" - tenantid $TenantFilter - asApp $true
35+
36+ if (-not $Policy ) {
37+ throw " Policy with ID $PolicyId not found in tenant $TenantFilter ."
38+ }
39+
40+ $PolicyName = $Policy.displayName
3541 if ($Request.Body.vacation -eq ' true' ) {
3642 $StartDate = $Request.Body.StartDate
3743 $EndDate = $Request.Body.EndDate
You can’t perform that action at this time.
0 commit comments