When parsing a DSC resource that contains variables in the array of values for one of the keys, the variable name ends up concatenated with the next member of the array in error.
For example, parsing the ExcludeGroups of the AADConditionalAccessPolicy resource below (additional properties removed for brevity):
Because this iterates once through the loop before checking the Until condition, it appends the ',' operator and the content of the following variable before it stops looping.
From testing it looks as though this can be solved by using a While loop instead:
This checks the condition before looping, so encounters the ',' operator and ends the loop. It still supports the advanced variables such as $Test.Nested.Variable, which I think was the original intention of the Do Until loop.
When parsing a DSC resource that contains variables in the array of values for one of the keys, the variable name ends up concatenated with the next member of the array in error.
For example, parsing the ExcludeGroups of the AADConditionalAccessPolicy resource below (additional properties removed for brevity):
Results in parsed results like this:
Rather than like this:
The problem appears to be with the Do Until loop at row 256 in Modules/DSCParser.psm1:
Because this iterates once through the loop before checking the Until condition, it appends the ',' operator and the content of the following variable before it stops looping.
From testing it looks as though this can be solved by using a While loop instead:
This checks the condition before looping, so encounters the ',' operator and ends the loop. It still supports the advanced variables such as $Test.Nested.Variable, which I think was the original intention of the Do Until loop.