DSCParser chokes on hyphens in Email Headers
Description of the issue
Cant create a report
Microsoft 365 DSC Version
PROD / Latest
Which workloads are affected
Security & Compliance Center
The DSC configuration
Error parsing configuration: At line:226 char:54
+ SetHeader = @{X-P...
+ ~
Missing '=' operator after key in hash literal.
At C:\Program Files\WindowsPowerShell\Modules\DSCParser\2.0.0.17\Modules\DSCParser.psm1:472 char:9
+ throw "$($errorPrefix)Error parsing configuration: $parseErro
Verbose logs showing the problem
Environment Information + PowerShell Version
@FlattusBlastus Can you share a bit more of your configuration for which you want to create the report? Especially the resource where the error occurs is of interest to us.
Not sure how to share more config. M365DSC is loaded on my work laptop running the PROD latest updates EXCEPT EOM 3.71 because 3.7.2 and above is busted.
When a rule in the web ui for Set headers is entered its HeaderName:HeaderValue. The script returns SetHeader =@{X-restofname = "VALUE"}
Hence the error shown above makes more sense.
Can you copy/paste the source file for which you want to generate the report? Or at least tell us the affected resource name? I don‘t know Exchange as well as the inside of my pocket, so a bit more information about the cirumstances around the issue would be really helpful.
E.g. the .ps1 from the config, a screenshot where the SetHeader property is set, or the command to generate the export (affected resources). Thank you.
Can you guys do a Premier support ticket?
M365DSC is not under coverage of the Premier support as far as I am aware of. It's either here with an issue or help yourself. Also, most of the work here is done by volunteers just like me, when the maintainers don't have enough time.
I'll see if I can meet with my TAM (cant remember the current name for that) and maybe they can reach out.
I think I found the problem: The export function for SetHeader produces @{ and not @("
@FlattusBlastus Can you confirm that SetHeader in your configuration is part of the SCDLPComplianceRule? Would have liked to have this information a bit earlier, then I can help you better than always asking for more information 😅 Can you still share this specific DLP rule (be it in an anonymized way if you want to) with us? Then we can check it with our own tests. Thank you.
I'll take a look at it tomorrow, but it seems to be what you're describing. SetHeader is supposed to be a string array, but the little bit you shared indicates that it's another type of object.
Output of M365TenantConfig.ps1 Broken - Stops creation of Excel report: SetHeader = @{X-EXC = "Excl"; }; I fixed the entries manually and the report completes: SetHeader = @("X-EXC = Excl");
Yes it is in the SCDLPComplianceRule. The error output is: Error parsing configuration: At line:2349 char:54
-
SetHeader = @{X-EXC = "Excl ... -
~
Missing '=' operator after key in hash literal. At C:\Program Files\WindowsPowerShell\Modules\DSCParser\2.0.0.17\Modules\DSCParser.psm1:472 char:9
-
throw "$($errorPrefix)Error parsing configuration: $parseErro ... -
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~- CategoryInfo : OperationStopped: (Error parsing c...n hash literal.:String) [], RuntimeException
- FullyQualifiedErrorId : Error parsing configuration: At line:2349 char:54
-
SetHeader = @{X-EXC = "Excl ... -
~
Missing '=' operator after key in hash literal.
In the UI with SetHeader it uses a colon for separation instead of = if that helps any. Whatever is formatting the output is doing it incorrectly.
Sorry - I can't send youM365TenantConfig.ps1 this way. Have Nik reach out to me on teams or contact [email protected] to get in contact with me. Charles Babcock.
@FlattusBlastus No worries, I have the information that's required. PR is open.