Skip to content

Commit 346cd84

Browse files
authored
Merge pull request #329 from KelvinTegelaar/dev
[pull] dev from KelvinTegelaar:dev
2 parents 4cffb9c + 14b60a5 commit 346cd84

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Modules/CIPPCore/Public/New-CIPPCAPolicy.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,9 @@ function New-CIPPCAPolicy {
117117
}
118118
}
119119

120-
121120
#for each of the locations, check if they exist, if not create them. These are in $jsonobj.LocationInfo
122121
$LocationLookupTable = foreach ($locations in $jsonobj.LocationInfo) {
122+
if (!$locations) { continue }
123123
foreach ($location in $locations) {
124124
if (!$location.displayName) { continue }
125125
$CheckExististing = New-GraphGETRequest -uri 'https://graph.microsoft.com/beta/identity/conditionalAccess/namedLocations' -tenantid $TenantFilter -asApp $true
@@ -233,7 +233,7 @@ function New-CIPPCAPolicy {
233233
$CheckExististing = New-GraphGETRequest -uri 'https://graph.microsoft.com/beta/identity/conditionalAccess/policies' -tenantid $TenantFilter -asApp $true | Where-Object -Property displayName -EQ $displayname
234234
if ($CheckExististing) {
235235
if ($Overwrite -ne $true) {
236-
Throw "Conditional Access Policy with Display Name $($Displayname) Already exists"
236+
throw "Conditional Access Policy with Display Name $($Displayname) Already exists"
237237
return $false
238238
} else {
239239
Write-Information "overwriting $($CheckExististing.id)"

0 commit comments

Comments
 (0)