Microsoft365DSC icon indicating copy to clipboard operation
Microsoft365DSC copied to clipboard

IntuneDeviceConfigurationPolicyMacOS : At least one of the values 'delayAppUpdateVisibility,delayMajorOsUpdateVisibility' is not supported

Open JIO-CIPP opened this issue 3 years ago • 11 comments

Details of the scenario you tried and the problem that is occurring

This happens after an export of the workload of Intune.

Verbose logs showing the problem

Microsoft365DSC\IntuneDeviceConfigurationPolicyMacOS : At least one of the values 'delayAppUpdateVisibility,delayMajorOsUpdateVisibility' is not supported or valid for property 'UpdateDelayPolicy' on class 'IntuneDeviceConfigurationPolicyMacOS'. Please specify only supported values: none, delayOSUpdateVisibility, delayAppUpdateVisibility, unknownFutureValue, delayMajorOsUpdateVisibility. At Path/filename.ps1:1589 char:9

  •     IntuneDeviceConfigurationPolicyMacOS 9a43fd65-02fc-4590-b154- ...
    
  •     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (:) [Write-Error], ParentContainsErrorRecordException
    • FullyQualifiedErrorId : UnsupportedValueForProperty,Microsoft365DSC\IntuneDeviceConfigurationPolicyMacOS

Suggested solution to the issue

The DSC configuration that is used to reproduce the issue (as detailed as possible)

Version of the DSC module that was used ('dev' if using current dev branch)

1.22.1221.1

JIO-CIPP avatar Jan 03 '23 05:01 JIO-CIPP

The parameter UpdateDelayPolicy is stored and returned as a string, but is an array of values under the covers (comma separated string). This means that it needs to get split on the comma character.

A second issue is that the current parameter is a string value, instead of an array value. This needs to get updated as well.

Working on correcting this issue.

ykuijs avatar Jan 03 '23 09:01 ykuijs

I've just updated and checked, but the error is still there for me. UpdateDelayPolicy = "delayAppUpdateVisibility","delayMajorOsUpdateVisibility"; == This one works with creating the mof file. UpdateDelayPolicy = @("delayAppUpdateVisibility,delayMajorOsUpdateVisibility"); = is how it's generated now.

JIO-CIPP avatar Jan 05 '23 06:01 JIO-CIPP

I see what the difference is between the two values you shared. Will investigate and correct the issue.

ykuijs avatar Jan 10 '23 07:01 ykuijs

I believe the updateDelayPolicy should be a single value and not an array as it is an enum https://learn.microsoft.com/en-us/graph/api/resources/intune-deviceconfig-macossoftwareupdatedelaypolicy?view=graph-rest-beta

William-Francillette avatar Jan 16 '23 09:01 William-Francillette

Not quite, the updateDelayPolicy can contain multiple values in Intune. Before the previous PR, this resulted in errors because the cmdlets return multiple values and the config only accepts a single value.

ykuijs avatar Jan 16 '23 09:01 ykuijs

A bit confused here as the policy should return a single value based on the definition image I also checked the metadata schema and there is no mention of collection image

If the resource returns more than one value, it could be an issue with the Get-TargetResource

Probably best to check what Get-MgDeviceManagementDeviceConfiguration returns

image The first Get using DisplayName could return multiple policies as the DisplayName is not unique - if that's the case then $getValue.AdditionalProperties.updateDelayPolicy will return multiple value

Possible fix would be to reduce the scope of Get-MgDeviceManagementDeviceConfiguration and DisplayName by adding the templateId of the policy - I also prefer using the Id as a first method to retrieve a policy rather than using displayName I would also filter on the server side instead of retrieving all device configuration policy - in a large environment it will not be efficient

William-Francillette avatar Jan 16 '23 10:01 William-Francillette

If I check the policy in the Admin portal, I am able to configure these settings: image

When I run these commands:

$getValue = Get-MgDeviceManagementDeviceConfiguration `
    -ErrorAction Stop | Where-Object `
    -FilterScript { $_.DisplayName -eq "testDSC" }

$getValue.AdditionalProperties.updateDelayPolicy

I get this result delayOSUpdateVisibility,delayAppUpdateVisibility,delayMajorOsUpdateVisibility

ykuijs avatar Jan 16 '23 11:01 ykuijs

Can you check how many policies are returned by the get cmdlet I guess the customer has 3 policies called testDSC

William-Francillette avatar Jan 16 '23 11:01 William-Francillette

Is on my Test tenant and I only have one TestDSC policy 😉

ykuijs avatar Jan 16 '23 11:01 ykuijs

My bad Yorick! I just checked the payload and it's not in accordance of the doc! updateDelayPolicy: "delayOSUpdateVisibility,delayAppUpdateVisibility,delayMajorOsUpdateVisibility" - the doc should be updated in my opinion I get the same result than you - building a single string from the array may resolve the issue

William-Francillette avatar Jan 16 '23 12:01 William-Francillette

Have updated the code. In my previous PR I made a stupid copy/paste mistake.

New fix will be included in a next PR

ykuijs avatar Jan 16 '23 12:01 ykuijs