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

Settings Catalog resources not working with 1.24.828.1 #5000

Closed
ricmestre opened this issue Aug 29, 2024 · 2 comments · Fixed by #5002 or #5019
Closed

Settings Catalog resources not working with 1.24.828.1 #5000

ricmestre opened this issue Aug 29, 2024 · 2 comments · Fixed by #5002 or #5019
Labels
Bug Something isn't working Intune V1.24.828.1 Version 1.24.828.1

Comments

@ricmestre
Copy link
Contributor

Description of the issue

Settings Catalog resources that call Get-IntuneSettingCatalogPolicySetting don't work correctly, this problem was introduced on PR #4962 and occurs when trying to create a new resource at the 1st attempt, the next attempt for some reason then works. This can be reproduced every time by just removing the existing policy and trying to recreate it.

@FabienTschanz First the foreach on Get-IntuneSettingCatalogPolicySettingDSCValue seems to loop several times over the same keys so somehow $global:excludedDscParams is not being updated correctly or at least not in all places it should be, then on the first loop all properties seem to work but on subsequent loops (which probably shouldn't run since it looks like they were processed) it always fails on last property UseAdvancedProtectionAgainstRansomware (using the attached blueprint). The problem occurs following this path:

Get-IntuneSettingCatalogPolicySetting
|-->Get-IntuneSettingCatalogPolicySettingInstanceValue
    |-->Get-IntuneSettingCatalogPolicySettingDSCValue

This then goes back to Get-IntuneSettingCatalogPolicySettingInstanceValue and fails on $SettingValueType = $valuesResult.SettingDefinition.AdditionalProperties.valueDefinition.'@odata.type'.Replace('Definition', '') because the returned value of $valuesResults is $null.

You cannot call a method on a null-valued expression.
+ CategoryInfo          : InvalidOperation: (:) [], CimException
FullyQualifiedErrorId : InvokeMethodOnNull
PSComputerName        : localhost

Could you please have a look into this?

Microsoft 365 DSC Version

1.24.828.1

Which workloads are affected

Intune

The DSC configuration

IntuneAttackSurfaceReductionRulesPolicyWindows10ConfigManager "IntuneAttackSurfaceReductionRulesPolicyWindows10ConfigManager-IntuneAttackSurfaceReductionRulesPolicyWindows10ConfigManager_1"
        {
            Assignments                                                                = @();
            blockabuseofexploitedvulnerablesigneddrivers                               = "block";
            blockadobereaderfromcreatingchildprocesses                                 = "block";
            blockallofficeapplicationsfromcreatingchildprocesses                       = "block";
            blockcredentialstealingfromwindowslocalsecurityauthoritysubsystem          = "block";
            blockexecutablecontentfromemailclientandwebmail                            = "block";
            blockexecutablefilesrunningunlesstheymeetprevalenceagetrustedlistcriterion = "block";
            blockexecutionofpotentiallyobfuscatedscripts                               = "block";
            blockjavascriptorvbscriptfromlaunchingdownloadedexecutablecontent          = "block";
            blockofficeapplicationsfromcreatingexecutablecontent                       = "block";
            blockofficeapplicationsfrominjectingcodeintootherprocesses                 = "block";
            blockofficecommunicationappfromcreatingchildprocesses                      = "block";
            blockpersistencethroughwmieventsubscription                                = "block";
            blockprocesscreationsfrompsexecandwmicommands                              = "block";
            blockuntrustedunsignedprocessesthatrunfromusb                              = "block";
            blockwin32apicallsfromofficemacros                                         = "block";
            Credential                                                                 = $CredsCredential;
            Description                                                                = "IntuneAttackSurfaceReductionRulesPolicyWindows10ConfigManager_1";
            DisplayName                                                                = "IntuneAttackSurfaceReductionRulesPolicyWindows10ConfigManager_1";
            Ensure                                                                     = "Present";
            Identity                                                                   = "f6d1d1bc-d78f-4a5a-8f1b-0d95a60b0bc1";
            useadvancedprotectionagainstransomware                                     = "block";
        }

Verbose logs showing the problem

You cannot call a method on a null-valued expression.
+ CategoryInfo          : InvalidOperation: (:) [], CimException
FullyQualifiedErrorId : InvokeMethodOnNull
PSComputerName        : localhost

Environment Information + PowerShell Version

Win11 / PS5
@NikCharlebois NikCharlebois added Bug Something isn't working Intune V1.24.828.1 Version 1.24.828.1 labels Aug 29, 2024
@FabienTschanz
Copy link
Contributor

@ricmestre On it, thanks for letting me know. I tested that thing rigorously and thought I found all issues, but apparently not...

@FabienTschanz
Copy link
Contributor

@ricmestre Found it, a simple null check was missing... Lucky for me I thought to abstract that stuff quite a bit, so that it's easy to fix. I guess I always tested it by accident with a value on these properties.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Intune V1.24.828.1 Version 1.24.828.1
Projects
None yet
3 participants