You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So now that I got the resource working I found out that there are two different problems with it in terms of testing its state after being deployed.
First problem is with Assignments, this CIM instance has some sub-properties that by default are either null or empty and those are not exported to the blueprint, so basically in terms of exporting the policy, then deleting it and finally recreating it with the same settings it works without issues but running Test-DSCConfiguration will fail (no errors, it just comes back as not in desired state) because those null or empty fields comparing to what's in the blueprint won't match since the properties are not there to begin with. To fix this is as simple as changing the code in Test-TargetResource used to compare CIM instances, I used the one that is used in MSFT_IntuneWindowsAutopilotDeploymentProfileAzureADHybridJoined which I know works.
Second problem is with property CompliantAppsList, which takes an array of CIM instances of type MSFT_MicrosoftGraphapplistitemMacOS, and this one is tricky because of the whole breaking change conversation, so what happens here is that exports end up with an array of MSFT_MicrosoftGraphapplistitem so MacOS is missing from the end of the string which causes in itself 2 problems, one is that it cannot be redeployed to the tenant since the datatype is not correct according to the schema, the other problem is that albeit Test-DSCConfiguration doesn't fail it will always report that the resource it's not in desired state even if it's sub-properties are all correct.
Fix for second problem is as simple as changing Export-TargetResource to export the correct CIM instance, but wouldn't this be considered a breaking change? I bet no one is using this resource even for monitoring or they would report it ages ago, but if this falls in breaking change waters then the fix here that wouldn't be considered as one (contrary to all other cases) is to actually change its datatype in the schema and in the module to MSFT_MicrosoftGraphapplistitem since that's what's currently being exported to the blueprints.
@NikCharlebois I'll raise a PR with fixes for both problems, for the second one I'll make the change to export the correct CIM instance, if you think I should instead change the datatype please let me know.
Description of the issue
So now that I got the resource working I found out that there are two different problems with it in terms of testing its state after being deployed.
First problem is with Assignments, this CIM instance has some sub-properties that by default are either null or empty and those are not exported to the blueprint, so basically in terms of exporting the policy, then deleting it and finally recreating it with the same settings it works without issues but running Test-DSCConfiguration will fail (no errors, it just comes back as not in desired state) because those null or empty fields comparing to what's in the blueprint won't match since the properties are not there to begin with. To fix this is as simple as changing the code in Test-TargetResource used to compare CIM instances, I used the one that is used in MSFT_IntuneWindowsAutopilotDeploymentProfileAzureADHybridJoined which I know works.
Second problem is with property CompliantAppsList, which takes an array of CIM instances of type MSFT_MicrosoftGraphapplistitemMacOS, and this one is tricky because of the whole breaking change conversation, so what happens here is that exports end up with an array of MSFT_MicrosoftGraphapplistitem so MacOS is missing from the end of the string which causes in itself 2 problems, one is that it cannot be redeployed to the tenant since the datatype is not correct according to the schema, the other problem is that albeit Test-DSCConfiguration doesn't fail it will always report that the resource it's not in desired state even if it's sub-properties are all correct.
Fix for second problem is as simple as changing Export-TargetResource to export the correct CIM instance, but wouldn't this be considered a breaking change? I bet no one is using this resource even for monitoring or they would report it ages ago, but if this falls in breaking change waters then the fix here that wouldn't be considered as one (contrary to all other cases) is to actually change its datatype in the schema and in the module to MSFT_MicrosoftGraphapplistitem since that's what's currently being exported to the blueprints.
@NikCharlebois I'll raise a PR with fixes for both problems, for the second one I'll make the change to export the correct CIM instance, if you think I should instead change the datatype please let me know.
Microsoft 365 DSC Version
1.24.110.1
Which workloads are affected
other
The DSC configuration
Verbose logs showing the problem
Environment Information + PowerShell Version
The text was updated successfully, but these errors were encountered: