Skip to content

Commit

Permalink
fixes ca issues
Browse files Browse the repository at this point in the history
  • Loading branch information
KelvinTegelaar committed Jun 21, 2024
1 parent 285e24c commit 95bd847
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ Function Invoke-AddIntuneTemplate {
$TemplateJson = $Template | ConvertTo-Json -Depth 100
$DisplayName = $Template.name


}
'windowsDriverUpdateProfiles' {
$Type = 'windowsDriverUpdateProfiles'
Expand Down
6 changes: 4 additions & 2 deletions Modules/CIPPCore/Public/Set-CIPPAssignedPolicy.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ function Set-CIPPAssignedPolicy {
$PolicyId,
$Type,
$TenantFilter,
$PlatformType = 'deviceManagement',
$PlatformType,
$APIName = 'Assign Policy',
$ExecutingUser
)

if (!$PlatformType) { $PlatformType = 'deviceManagement' }
try {
$assignmentsObject = switch ($GroupName) {
'allLicensedUsers' {
Expand Down Expand Up @@ -70,9 +70,11 @@ function Set-CIPPAssignedPolicy {
assignments = @($assignmentsObject)
}
if ($PSCmdlet.ShouldProcess($GroupName, "Assigning policy $PolicyId")) {
Write-Host "https://graph.microsoft.com/beta/$($PlatformType)/$Type('$($PolicyId)')/assign"
$null = New-GraphPOSTRequest -uri "https://graph.microsoft.com/beta/$($PlatformType)/$Type('$($PolicyId)')/assign" -tenantid $tenantFilter -type POST -body ($assignmentsObject | ConvertTo-Json -Depth 10)
Write-LogMessage -user $ExecutingUser -API $APIName -message "Assigned Policy to $($GroupName)" -Sev 'Info' -tenant $TenantFilter
}

return "Assigned policy to $($GroupName) Policy ID is $($PolicyId)."
} catch {
Write-LogMessage -user $ExecutingUser -API $APIName -message "Failed to assign Policy to $GroupName. Policy ID is $($PolicyId)." -Sev 'Error' -tenant $TenantFilter -LogData (Get-CippException -Exception $_)
Expand Down

0 comments on commit 95bd847

Please sign in to comment.