Microsoft365DSC icon indicating copy to clipboard operation
Microsoft365DSC copied to clipboard

IntuneEndpointDetectionAndResponsePolicy{Linux/MacOS}: Not able to deploy or modify

Open ricmestre opened this issue 7 months ago • 1 comments

Description of the issue

@FabienTschanz Found 2 more that I'm not able to deploy anymore, nor modify, with the breaking change release, I created both manually and exporting them they got exported exactly with the same configs I already have so it's not a problem with my configs/schemas, the requests just seem to not being sent correctly and they fail with the same error message [] : The request is invalid. and there's nothing else in event viewer.

Note that I'm able to delete them correctly just by using Ensure = "Absent", just not create/modify. I'm also having issues with IntuneEndpointDetectionAndResponsePolicyWindows10 but this one hasn't been working for quite some time, it's not the same problem affecting those other 2.

Microsoft 365 DSC Version

1.26.408.1

Which workloads are affected

Intune

The DSC configuration

     IntuneEndpointDetectionAndResponsePolicyLinux "IntuneEndpointDetectionAndResponsePolicyLinux-IntuneEndpointDetectionAndResponsePolicyLinux_1"
            Assignments          = @(
                MSFT_DeviceManagementConfigurationPolicyAssignments{
                    dataType = "#microsoft.graph.groupAssignmentTarget"
                    deviceAndAppManagementAssignmentFilterType = "none"
                    groupDisplayName = "DummyGroupInclude"
                    groupId = "b0b8fd3f-af2a-453b-be57-80182d599f02"
                }
                MSFT_DeviceManagementConfigurationPolicyAssignments{
                    dataType = "#microsoft.graph.exclusionGroupAssignmentTarget"
                    deviceAndAppManagementAssignmentFilterType = "none"
                    groupDisplayName = "DummyGroupExclude"
                    groupId = "053dc89a-be83-411a-bad3-909904b7239e"
                }
            );
            Credential           = $Credscredential;
            Description          = "IntuneEndpointDetectionAndResponsePolicyLinux_1";
            DisplayName          = "IntuneEndpointDetectionAndResponsePolicyLinux_1";
            Ensure               = "Present";
            Id                   = "e3b05409-5f1d-4b54-b5bd-2c76154162e5";
            RoleScopeTagIds      = @("0");
            tags_item_key        = "GROUP";
            tags_item_value      = "Test";
        }
        IntuneEndpointDetectionAndResponsePolicyMacOS "IntuneEndpointDetectionAndResponsePolicyMacOS-IntuneEndpointDetectionAndResponsePolicyMacOS_1"
        {
            Assignments          = @(
                MSFT_DeviceManagementConfigurationPolicyAssignments{
                    dataType = "#microsoft.graph.groupAssignmentTarget"
                    deviceAndAppManagementAssignmentFilterType = "none"
                    groupDisplayName = "DummyGroupInclude"
                    groupId = "b0b8fd3f-af2a-453b-be57-80182d599f02"
                }
                MSFT_DeviceManagementConfigurationPolicyAssignments{
                    dataType = "#microsoft.graph.exclusionGroupAssignmentTarget"
                    deviceAndAppManagementAssignmentFilterType = "none"
                    groupDisplayName = "DummyGroupExclude"
                    groupId = "053dc89a-be83-411a-bad3-909904b7239e"
                }
            );
            Credential           = $Credscredential;
            Description          = "IntuneEndpointDetectionAndResponsePolicyMacOS_1";
            DisplayName          = "IntuneEndpointDetectionAndResponsePolicyMacOS_1";
            Ensure               = "Present";
            Id                   = "76db2c53-1b55-4a74-a8da-1d7e4e724074";
            RoleScopeTagIds      = @("0");
            tags_item_key        = "GROUP";
            tags_item_value      = "Test";
        }

Verbose logs showing the problem

[] : The request is invalid.
+ CategoryInfo          : InvalidOperation: ({ Headers = , b...urationPolicy }:) [], CimException
+ FullyQualifiedErrorId :
Microsoft.Graph.Beta.PowerShell.Cmdlets.NewMgBetaDeviceManagementConfigurationPolicy_Create
+ PSComputerName        : localhost

Environment Information + PowerShell Version

Win11/PS5.1

ricmestre avatar Apr 12 '26 21:04 ricmestre

A fix has been proposed and opened in PR #7057: https://github.com/Microsoft365DSC/Microsoft365DSC/pull/7057

What was fixed

  • Added option-name fallback for Intune choice value resolution (handles values like GROUP when metadata exposes them via option name).
  • Preserved existing matching behavior (optionValue.value and itemId fallback).
  • Added a guard to avoid serializing empty choice values into the Graph payload.

Why this addresses the issue

For Linux/MacOS EDR tags, create/update could build an invalid request when tags_item_key failed to resolve to a valid option itemId, resulting in The request is invalid.

The PR keeps the fix targeted to the shared Intune Settings Catalog resolver/builder path used by these resources.

Shirshaw64p avatar Apr 13 '26 02:04 Shirshaw64p