Open dannyKBjj opened 2 days ago
@dannyKBjj I think that Get-M365DSCExportContentForResource
should do the conversion and escape the quotes with a backtick only if they are inside of another string. Otherwise, it should preserve the current state of it. That's how it's handled across all resources, also with some resources that I just developed it works fine.
Do you have an example file to take a look at?
Description of the issue
Am creating a custom DSC resource for #microsoft.graph.iosMobileAppConfiguration , for the most part it works fine, but some of the settings for some policies contain quotes in the string. For example and iOS Edge AI policy
URLBlocklist stringtype ["edge://flags","edge://inspect","edge://optimization-guide-internals","edge://password-manager-internals"]
is exported to the M365TenantConfig.ps1 with back-ticks instead of quotes. i.e. [
edge://flags
,edge://inspect
,edge://optimization-guide-internals
,edge://password-manager-internals
] . The .mof will compile fine, but then report 'false' when tested. Replacing ` with " in the .ps1 and recompiling the .mof fixes the issue. The data is retrieved correctly. Problem seems to be with either Get-M365DSCExportContentForResource or Convert-DSCStringParamToVariable. I'd assume it is a wider issue with handling quotes in strings.Microsoft 365 DSC Version
1.24.1016.1
Which workloads are affected
other
The DSC configuration
Verbose logs showing the problem
Environment Information + PowerShell Version