Skip to content

Commit

Permalink
Merge pull request #4890 from FabienTschanz/fix/driver-update-assignm…
Browse files Browse the repository at this point in the history
…ents

Add support for converting Intune assignments directly from Graph
  • Loading branch information
NikCharlebois committed Jul 17, 2024
2 parents 50aeed0 + f65e3b8 commit 3a3fade
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
FIXES [#2659](https://github.com/microsoft/Microsoft365DSC/issues/2659)
* M365DSCDRGUtil
* Fixes an issue with nested and duplicate settings in the settings catalog
* Add support for converting Intune assignments directly from Graph.
FIXES [#4875](https://github.com/microsoft/Microsoft365DSC/issues/4875)
* M365DSCResourceGenerator
* Update Intune resource generation.
* M365DSCReport
Expand Down
29 changes: 26 additions & 3 deletions Modules/Microsoft365DSC/Modules/M365DSCDRGUtil.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -1091,9 +1091,32 @@ function ConvertFrom-IntunePolicyAssignment
foreach ($assignment in $Assignments)
{
$hashAssignment = @{}
$dataType = $assignment.Target.AdditionalProperties."@odata.type"
$groupId = $assignment.Target.AdditionalProperties.groupId
$collectionId = $assignment.Target.AdditionalProperties.collectionId
if ($null -ne $assignment.Target.'@odata.type')
{
$dataType = $assignment.Target.'@odata.type'
}
else
{
$dataType = $assignment.Target.AdditionalProperties.'@odata.type'
}

if ($null -ne $assignment.Target.groupId)
{
$groupId = $assignment.Target.groupId
}
else
{
$groupId = $assignment.Target.AdditionalProperties.groupId
}

if ($null -ne $assignment.Target.collectionId)
{
$collectionId = $assignment.Target.collectionId
}
else
{
$collectionId = $assignment.Target.AdditionalProperties.collectionId
}

$hashAssignment.Add('dataType',$dataType)
if (-not [string]::IsNullOrEmpty($groupId))
Expand Down

0 comments on commit 3a3fade

Please sign in to comment.