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

IntuneDeviceConfigurationAdministrativeTemplatePolicyWindows10: Not all properties are printed correctly to the blueprint #3634

Closed
ricmestre opened this issue Sep 1, 2023 · 5 comments · Fixed by #3705 or #3707
Labels
Bug Something isn't working Core Engine

Comments

@ricmestre
Copy link
Contributor

ricmestre commented Sep 1, 2023

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

After an export on at least resource IntuneDeviceConfigurationAdministrativeTemplatePolicyWindows10, this most likely affects others as well, some properties are not being placed in the correct lines (basically missing `r`n) which then ConvertTo-DSCObject complains about.

In this specific case the problem is with property Enabled which is inside CIMInstance MSFT_IntuneGroupPolicyDefinitionValue

Verbose logs showing the problem

WARNING: ConvertTo-DSCObject: "" (line 412): There is an incomplete property assignment block in the instance 
definition.
WARNING: ConvertTo-DSCObject: "}" (line 413): Missing closing ')' in subexpression.
WARNING: ConvertTo-DSCObject: "" (line 426): There is an incomplete property assignment block in the instance 
definition.
WARNING: ConvertTo-DSCObject: "" (line 440): There is an incomplete property assignment block in the instance 
definition.
WARNING: ConvertTo-DSCObject: ")" (line 455): Unexpected token ')' in expression or statement.
WARNING: ConvertTo-DSCObject: "}" (line 461): Unexpected token '}' in expression or statement.
WARNING: ConvertTo-DSCObject: "}" (line 2647): Unexpected token '}' in expression or statement.
WARNING: ConvertTo-DSCObject: "}" (line 2648): Unexpected token '}' in expression or statement.
WARNING: ConvertTo-DSCObject: "IntuneDeviceConfigurationAdministrativeTemplatePolicyWindows10" (line 384): Resource 'IntuneDeviceConfigurationAdministrativeTemplatePolicyWindows10' requires that a value of type 'String' be provided for property 'DisplayName'

Suggested solution to the issue

Ensure a new line is added per each new property of the resource

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

        IntuneDeviceConfigurationAdministrativeTemplatePolicyWindows10 "IntuneDeviceConfigurationAdministrativeTemplatePolicyWindows10-REDACTED"
        {
            Assignments          = @(
                MSFT_DeviceManagementConfigurationPolicyAssignments{
                    deviceAndAppManagementAssignmentFilterType = 'none'
                    dataType = '#microsoft.graph.exclusionGroupAssignmentTarget'
                    groupId = 'REDACTED'
                }
                MSFT_DeviceManagementConfigurationPolicyAssignments{
                    deviceAndAppManagementAssignmentFilterType = 'none'
                    dataType = '#microsoft.graph.groupAssignmentTarget'
                    groupId = 'REDACTED'
                });
            Credential           = $Credscredential;
            DefinitionValues     = @(
                MSFT_IntuneGroupPolicyDefinitionValue{
                    ConfigurationType = 'policy'

                    Id = 'REDACTED'

                    Definition = MSFT_IntuneGroupPolicyDefinitionValueDefinition{
                        Id = 'REDACTED'
                        DisplayName = 'Silently sign in users to the OneDrive sync app with their Windows credentials'
                        CategoryPath = '\OneDrive'
                        PolicyType = 'admxIngested'
                        SupportedOn = 'At least Windows Server 2008 R2 or Windows 7'
                        ClassType = 'machine'
                    }                    Enabled = $True # <----------------------------- Problem here
                }
                MSFT_IntuneGroupPolicyDefinitionValue{
                    ConfigurationType = 'policy'

                    Id = 'REDACTED'

                    Definition = MSFT_IntuneGroupPolicyDefinitionValueDefinition{
                        Id = 'REDACTED'
                        DisplayName = 'Prevent users from syncing libraries and folders shared from other organizations'
                        CategoryPath = '\OneDrive'
                        PolicyType = 'admxIngested'
                        SupportedOn = 'At least Windows Server 2008 R2 or Windows 7'
                        ClassType = 'machine'
                    }                    Enabled = $True # <----------------------------- Problem here
                }
                MSFT_IntuneGroupPolicyDefinitionValue{
                    ConfigurationType = 'policy'

                    Id = 'REDACTED'

                    Definition = MSFT_IntuneGroupPolicyDefinitionValueDefinition{
                        Id = 'REDACTED'
                        DisplayName = 'Require users to confirm large delete operations'
                        CategoryPath = '\OneDrive'
                        PolicyType = 'admxIngested'
                        SupportedOn = 'At least Windows Server 2008 R2 or Windows 7'
                        ClassType = 'machine'
                    }                    Enabled = $True # <----------------------------- Problem here
                }
                MSFT_IntuneGroupPolicyDefinitionValue{
                    ConfigurationType = 'policy'

                    Id = 'REDACTED'

                    Definition = MSFT_IntuneGroupPolicyDefinitionValueDefinition{
                        Id = 'REDACTED'
                        DisplayName = 'Use OneDrive Files On-Demand'
                        CategoryPath = '\OneDrive'
                        PolicyType = 'admxIngested'
                        SupportedOn = 'At least Windows Server 2016, Windows 10 Version 1709'
                        ClassType = 'machine'
                    }                    Enabled = $True # <----------------------------- Problem here
                });
            DisplayName          = "REDACTED";
            Ensure               = "Present";
            Id                   = "REDACTED";
        }

The operating system the target node is running

Win10

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

1.23.830.1

@ricmestre
Copy link
Contributor Author

This is not happening on 1.23.823.1 so this is either caused by the changes to Get-M365DSCDRGComplexTypeToString in commit 61260b5 and/or the changes made in ReverseDSC 2.0.0.18.

@andikrueger andikrueger added Bug Something isn't working Core Engine labels Sep 4, 2023
@ricmestre
Copy link
Contributor Author

@NikCharlebois You've raised PR #3647 to fix an issue on AADAuthenticationMethodPolicyAuthenticator but this is affecting other resources as well such as IntuneDeviceConfigurationAdministrativeTemplatePolicyWindows10 and probably others, could we get a permanent fix for all of them instead? Like I mention in my previous comment this issue started happening after 1.23.823.1.

@cpc-alruba
Copy link

Having the exact same issue when trying to generate a delta report for Intune config. Are we going to see a fix to the problem anytime soon?

stuck on parsing and never move to the next step. been failing since Aug 30!

image

@satsuk81
Copy link

The formating fix for #3645 uses a general string replace to achieve the desired result:

# FIX #3645
$currentDSCBlock = $currentDSCBlock.Replace("} State = 'default'`r`n","}`r`n State = 'default'`r`n")

This may also work for the formatting for:
Enabled = $True
as there are only two boolean possibilities to account for.

But I am also experiencing the issue with the following:
SettingDefinitionId = ...
which has many multiple of possible variations.

I see in M365DSCDRGUtil.psm1, the Remove-M365DSCCimInstanceTrailingCharacterFromExport function looks to clean up the DSCBlock formatting so perhaps we can add something like:

$DSCBlock = $DSCBlock.replace("} ","}`r`n ")

@ricmestre
Copy link
Contributor Author

Any news about this issue? This is affecting other resources and also other cmdlets such as New-M365DSCReportFromConfiguration reported on #3640.

Please get a generic fix, not a workaround as done on #3647 otherwise the problem will still happen on other places.

Furthermore, currently due to other unrelated issue, happening on another version, plus this one I'm still stuck on version 1.23.726.1 on our servers and cannot update so I'd appreciate this to be looked at.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Core Engine
Projects
None yet
4 participants