Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IntuneDeviceConfigurationPolicyWindows10: Support setting assignment groups by display name #3763

Merged
merged 19 commits into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
4f0fb5e
Support setting assignment groups by display name
ricmestre Oct 6, 2023
5142a3e
No intention to change this to lowercase
ricmestre Oct 6, 2023
efe6f69
Fix example file
ricmestre Oct 9, 2023
6b43ef3
Change property to odataType and remove groupId if unique
ricmestre Oct 9, 2023
6e1de6c
Missed in previous
ricmestre Oct 9, 2023
0d3028a
Merge branch 'Dev' of https://github.com/microsoft/Microsoft365DSC in…
ricmestre Oct 11, 2023
844ea40
Change property name back to dataType
ricmestre Oct 11, 2023
55dd571
Merge branch 'Dev' of https://github.com/microsoft/Microsoft365DSC in…
ricmestre Oct 11, 2023
4291932
Merge branch 'Dev' into Dev
NikCharlebois Oct 11, 2023
24fe7db
Merge branch 'Dev' of https://github.com/microsoft/Microsoft365DSC in…
ricmestre Oct 11, 2023
b8b267e
Merge branch 'Dev' of github.com:ricmestre/Microsoft365DSC into Dev
ricmestre Oct 11, 2023
67b6fcb
Add groupDisplayName to all MSFT_DeviceManagementConfigurationPolicyA…
ricmestre Oct 11, 2023
59c5d64
Missed in previous
ricmestre Oct 11, 2023
fa16720
Change CIMInstance name back to MSFT_DeviceManagementConfigurationPol…
ricmestre Oct 11, 2023
c6b7091
Remove duplicated property
ricmestre Oct 11, 2023
3c3d24a
Merge branch 'Dev' of https://github.com/microsoft/Microsoft365DSC in…
ricmestre Oct 11, 2023
89a4474
Missed to change CIMInstance name in schema
ricmestre Oct 12, 2023
51453f3
Merge branch 'Dev' of https://github.com/microsoft/Microsoft365DSC in…
ricmestre Oct 16, 2023
bfd2ae2
Fix CIM instance type
ricmestre Oct 16, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Change property to odataType and remove groupId if unique
  • Loading branch information
ricmestre committed Oct 9, 2023
commit 6b43ef33e1cbe2c0a3d229577f702db22488068f
Original file line number Diff line number Diff line change
Expand Up @@ -1980,21 +1980,28 @@ function Get-TargetResource
$assignmentResult = @()
foreach ($assignmentEntry in $AssignmentsValues)
{
$Group = Get-MgGroup -GroupId $assignmentEntry.Target.AdditionalProperties.groupId -ErrorAction SilentlyContinue
$ODataType = $assignmentEntry.Target.AdditionalProperties.'@odata.type'
$GroupId = $assignmentEntry.Target.AdditionalProperties.groupId
$GroupDisplayName = $null
if ($Group.Count -eq 1)
{
$GroupDisplayName = $Group.DisplayName

if ($ODataType -eq "#microsoft.graph.groupAssignmentTarget" -or `
$ODataType -eq "#microsoft.graph.exclusionGroupAssignmentTarget") {
$Group = Get-MgGroup -GroupId $GroupId -ErrorAction SilentlyContinue
if ($Group.Count -eq 1)
{
$GroupDisplayName = $Group.DisplayName
$GroupId = $null
}
}

$assignmentValue = @{
dataType = $assignmentEntry.Target.AdditionalProperties.'@odata.type'
odataType = $ODataType
deviceAndAppManagementAssignmentFilterType = $(if ($null -ne $assignmentEntry.Target.DeviceAndAppManagementAssignmentFilterType)
{
$assignmentEntry.Target.DeviceAndAppManagementAssignmentFilterType.ToString()
})
deviceAndAppManagementAssignmentFilterId = $assignmentEntry.Target.DeviceAndAppManagementAssignmentFilterId
groupId = $assignmentEntry.Target.AdditionalProperties.groupId
groupId = $GroupId
groupDisplayName = $GroupDisplayName
}
$assignmentResult += $assignmentValue
Expand Down Expand Up @@ -3333,8 +3340,8 @@ function Set-TargetResource
$assignmentsHash = @()
foreach ($assignment in $Assignments)
{
if ($Assignment.dataType -eq "#microsoft.graph.groupAssignmentTarget" -or `
$Assignment.dataType -eq "#microsoft.graph.exclusionGroupAssignmentTarget")
if ($Assignment.odataType -eq "#microsoft.graph.groupAssignmentTarget" -or `
$Assignment.odataType -eq "#microsoft.graph.exclusionGroupAssignmentTarget")
{
if (![string]::IsNullOrEmpty($Assignment.groupId))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Configuration Example
Assignments = @(
MSFT_IntuneDeviceConfigurationPolicyWindows10Assignments{
deviceAndAppManagementAssignmentFilterType = 'none'
dataType = '#microsoft.graph.allDevicesAssignmentTarget'
odataType = '#microsoft.graph.allDevicesAssignmentTarget'
}
);
AuthenticationAllowSecondaryDevice = $False;
Expand Down