Skip to content

Commit da19911

Browse files
apiname bug
1 parent f9faf88 commit da19911

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Modules/CIPPCore/Public/New-CIPPCAPolicy.ps1

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,14 @@ function New-CIPPCAPolicy {
4444
$GroupIds = [System.Collections.Generic.List[string]]::new()
4545
$groupNames | ForEach-Object {
4646
if (Test-IsGuid $_) {
47-
Write-LogMessage -Headers $User -API $APINAME -message "Already GUID, no need to replace: $_" -Sev 'Debug'
47+
Write-LogMessage -Headers $User -API 'Create CA Policy' -message "Already GUID, no need to replace: $_" -Sev 'Debug'
4848
$GroupIds.Add($_) # it's a GUID, so we keep it
4949
} else {
5050
$groupId = ($groups | Where-Object -Property displayName -EQ $_).id # it's a display name, so we get the group ID
5151
if ($groupId) {
5252
foreach ($gid in $groupId) {
5353
Write-Warning "Replaced group name $_ with ID $gid"
54-
$null = Write-LogMessage -Headers $User -API $APINAME -message "Replaced group name $_ with ID $gid" -Sev 'Debug'
54+
$null = Write-LogMessage -Headers $User -API 'Create CA Policy' -message "Replaced group name $_ with ID $gid" -Sev 'Debug'
5555
$GroupIds.Add($gid) # add the ID to the list
5656
}
5757
} else {
@@ -68,14 +68,14 @@ function New-CIPPCAPolicy {
6868
$UserIds = [System.Collections.Generic.List[string]]::new()
6969
$userNames | ForEach-Object {
7070
if (Test-IsGuid $_) {
71-
Write-LogMessage -Headers $User -API $APINAME -message "Already GUID, no need to replace: $_" -Sev 'Debug'
71+
Write-LogMessage -Headers $User -API 'Create CA Policy' -message "Already GUID, no need to replace: $_" -Sev 'Debug'
7272
$UserIds.Add($_) # it's a GUID, so we keep it
7373
} else {
7474
$userId = ($users | Where-Object -Property displayName -EQ $_).id # it's a display name, so we get the user ID
7575
if ($userId) {
7676
foreach ($uid in $userId) {
7777
Write-Warning "Replaced user name $_ with ID $uid"
78-
$null = Write-LogMessage -Headers $User -API $APINAME -message "Replaced user name $_ with ID $uid" -Sev 'Debug'
78+
$null = Write-LogMessage -Headers $User -API 'Create CA Policy' -message "Replaced user name $_ with ID $uid" -Sev 'Debug'
7979
$UserIds.Add($uid) # add the ID to the list
8080
}
8181
} else {
@@ -245,7 +245,7 @@ function New-CIPPCAPolicy {
245245
} else {
246246
Write-Information "overwriting $($CheckExististing.id)"
247247
$null = New-GraphPOSTRequest -uri "https://graph.microsoft.com/beta/identity/conditionalAccess/policies/$($CheckExististing.id)" -tenantid $tenantfilter -type PATCH -body $RawJSON -asApp $true
248-
Write-LogMessage -Headers $User -API $APINAME -tenant $($Tenant) -message "Updated Conditional Access Policy $($JSONObj.Displayname) to the template standard." -Sev 'Info'
248+
Write-LogMessage -Headers $User -API 'Create CA Policy' -tenant $($Tenant) -message "Updated Conditional Access Policy $($JSONObj.Displayname) to the template standard." -Sev 'Info'
249249
return "Updated policy $displayname for $tenantfilter"
250250
}
251251
} else {
@@ -254,7 +254,7 @@ function New-CIPPCAPolicy {
254254
Start-Sleep 3
255255
}
256256
$null = New-GraphPOSTRequest -uri 'https://graph.microsoft.com/beta/identity/conditionalAccess/policies' -tenantid $tenantfilter -type POST -body $RawJSON -asApp $true
257-
Write-LogMessage -Headers $User -API $APINAME -tenant $($Tenant) -message "Added Conditional Access Policy $($JSONObj.Displayname)" -Sev 'Info'
257+
Write-LogMessage -Headers $User -API 'Create CA Policy' -tenant $($Tenant) -message "Added Conditional Access Policy $($JSONObj.Displayname)" -Sev 'Info'
258258
return "Created policy $displayname for $tenantfilter"
259259
}
260260
} catch {

0 commit comments

Comments
 (0)