Open raandree opened 3 months ago
You can always use ConvertTo-DSCObject from DSCParser applied to the exported blueprint and then convert the object to JSON, there's also ConvertFrom-DSCObject that does the reverse.
Thanks for he hint, @ricmestre. I have tried that with a very simple configuration generated with a Microsoft365DSC export. I have used this command:
ConvertTo-DSCObject -Path .\M365TenantConfig.ps1
The result was not very useful. Am I using the command in the wrong way?
InvalidOperation: Cannot index into a null array.
InvalidOperation: Cannot index into a null array.
InvalidOperation: Cannot index into a null array.
InvalidOperation: Cannot index into a null array.
InvalidOperation: Cannot index into a null array.
InvalidOperation: Cannot index into a null array.
InvalidOperation: Cannot index into a null array.
InvalidOperation: Cannot index into a null array.
InvalidOperation: Cannot index into a null array.
InvalidOperation: Cannot index into a null array.
InvalidOperation: Cannot index into a null array.
InvalidOperation: Cannot index into a null array.
InvalidOperation: Cannot index into a null array.
InvalidOperation: Cannot index into a null array.
InvalidOperation: Cannot index into a null array.
InvalidOperation: Cannot index into a null array.
InvalidOperation: Cannot index into a null array.
InvalidOperation: Cannot index into a null array.
InvalidOperation: Cannot index into a null array.
InvalidOperation: Cannot index into a null array.
InvalidOperation: Cannot index into a null array.
InvalidOperation: Cannot index into a null array.
InvalidOperation: Cannot index into a null array.
InvalidOperation: Cannot index into a null array.
InvalidOperation: Cannot index into a null array.
InvalidOperation: Cannot index into a null array.
InvalidOperation: Cannot index into a null array.
InvalidOperation: Cannot index into a null array.
InvalidOperation: Cannot index into a null array.
InvalidOperation: Cannot index into a null array.
Name Value
---- -----
ResourceInstanceName
ResourceName
ResourceInstanceName
ResourceName
ResourceInstanceName
ResourceName
ResourceInstanceName
ResourceName
ResourceInstanceName
ResourceName
ResourceInstanceName
ResourceName
ResourceInstanceName
ResourceName
ResourceInstanceName
ResourceName
ResourceInstanceName
ResourceName
ResourceInstanceName
ResourceName
M365DSC exports data as a .ps1 script. That does not scale and does not allow converting the data to JSON or YAML.
There is a promising MOF Parser but this parser cannot handle complex data types. An issue is open: KingslandConsulting/Kingsland.MofParser#83.
The most promising way is to rewrite the M365DSC export routing to get data and not PowerShell code.