@@ -44,14 +44,14 @@ function New-CIPPCAPolicy {
44
44
$GroupIds = [System.Collections.Generic.List [string ]]::new()
45
45
$groupNames | ForEach-Object {
46
46
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'
48
48
$GroupIds.Add ($_ ) # it's a GUID, so we keep it
49
49
} else {
50
50
$groupId = ($groups | Where-Object - Property displayName -EQ $_ ).id # it's a display name, so we get the group ID
51
51
if ($groupId ) {
52
52
foreach ($gid in $groupId ) {
53
53
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'
55
55
$GroupIds.Add ($gid ) # add the ID to the list
56
56
}
57
57
} else {
@@ -68,14 +68,14 @@ function New-CIPPCAPolicy {
68
68
$UserIds = [System.Collections.Generic.List [string ]]::new()
69
69
$userNames | ForEach-Object {
70
70
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'
72
72
$UserIds.Add ($_ ) # it's a GUID, so we keep it
73
73
} else {
74
74
$userId = ($users | Where-Object - Property displayName -EQ $_ ).id # it's a display name, so we get the user ID
75
75
if ($userId ) {
76
76
foreach ($uid in $userId ) {
77
77
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'
79
79
$UserIds.Add ($uid ) # add the ID to the list
80
80
}
81
81
} else {
@@ -245,7 +245,7 @@ function New-CIPPCAPolicy {
245
245
} else {
246
246
Write-Information " overwriting $ ( $CheckExististing.id ) "
247
247
$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'
249
249
return " Updated policy $displayname for $tenantfilter "
250
250
}
251
251
} else {
@@ -254,7 +254,7 @@ function New-CIPPCAPolicy {
254
254
Start-Sleep 3
255
255
}
256
256
$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'
258
258
return " Created policy $displayname for $tenantfilter "
259
259
}
260
260
} catch {
0 commit comments