-
Notifications
You must be signed in to change notification settings - Fork 517
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3790 from swisscom/fix/IntuneRoleAssignment-Defin…
…ition-Beta Fix IntuneRoleAssignment missing use of Beta Graph module #3590
- Loading branch information
Showing
3 changed files
with
235 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -103,7 +103,7 @@ function Get-TargetResource | |
$getValue = $null | ||
if ($Id -match '^[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}$') | ||
{ | ||
$getValue = Get-MgDeviceManagementRoleAssignment -DeviceAndAppManagementRoleAssignmentId $id -ErrorAction SilentlyContinue | ||
$getValue = Get-MgBetaDeviceManagementRoleAssignment -DeviceAndAppManagementRoleAssignmentId $id -ErrorAction SilentlyContinue | ||
if ($null -ne $getValue) | ||
{ | ||
Write-Verbose -Message "Found something with id {$id}" | ||
|
@@ -113,7 +113,7 @@ function Get-TargetResource | |
{ | ||
Write-Verbose -Message "Nothing with id {$id} was found" | ||
$Filter = "displayName eq '$DisplayName'" | ||
$getValue = Get-MgDeviceManagementRoleAssignment -Filter $Filter -ErrorAction SilentlyContinue | ||
$getValue = Get-MgBetaDeviceManagementRoleAssignment -Filter $Filter -ErrorAction SilentlyContinue | ||
if ($null -ne $getValue) | ||
{ | ||
Write-Verbose -Message "Found something with displayname {$DisplayName}" | ||
|
@@ -386,7 +386,7 @@ function Set-TargetResource | |
'@odata.type' = '#microsoft.graph.deviceAndAppManagementRoleAssignment' | ||
'[email protected]' = "https://graph.microsoft.com/beta/deviceManagement/roleDefinitions('$roleDefinition')" | ||
} | ||
$policy = New-MgDeviceManagementRoleAssignment -BodyParameter $CreateParameters | ||
$policy = New-MgBetaDeviceManagementRoleAssignment -BodyParameter $CreateParameters | ||
|
||
} | ||
elseif ($Ensure -eq 'Present' -and $currentInstance.Ensure -eq 'Present') | ||
|
@@ -403,14 +403,14 @@ function Set-TargetResource | |
'[email protected]' = "https://graph.microsoft.com/beta/deviceManagement/roleDefinitions('$roleDefinition')" | ||
} | ||
|
||
Update-MgDeviceManagementRoleAssignment -BodyParameter $UpdateParameters ` | ||
Update-MgBetaDeviceManagementRoleAssignment -BodyParameter $UpdateParameters ` | ||
-DeviceAndAppManagementRoleAssignmentId $currentInstance.Id | ||
|
||
} | ||
elseif ($Ensure -eq 'Absent' -and $currentInstance.Ensure -eq 'Present') | ||
{ | ||
Write-Verbose -Message "Removing {$DisplayName}" | ||
Remove-MgDeviceManagementRoleAssignment -DeviceAndAppManagementRoleAssignmentId $currentInstance.Id | ||
Remove-MgBetaDeviceManagementRoleAssignment -DeviceAndAppManagementRoleAssignmentId $currentInstance.Id | ||
} | ||
} | ||
|
||
|
@@ -644,15 +644,15 @@ function Export-TargetResource | |
|
||
try | ||
{ | ||
[array]$getValue = Get-MgDeviceManagementRoleAssignment ` | ||
[array]$getValue = Get-MgBetaDeviceManagementRoleAssignment ` | ||
-ErrorAction Stop | Where-Object ` | ||
-FilterScript { ` | ||
$_.AdditionalProperties.'@odata.type' -eq '#microsoft.graph.deviceAndAppManagementRoleAssignment' ` | ||
} | ||
|
||
if (-not $getValue) | ||
{ | ||
[array]$getValue = Get-MgDeviceManagementRoleAssignment ` | ||
[array]$getValue = Get-MgBetaDeviceManagementRoleAssignment ` | ||
-ErrorAction Stop | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.