Open o-l-a-v opened 6 months ago
Thanks for reporting the issue @o-l-a-v.
Also maybe check out this example for building a baseline dynamically. https://github.com/Azure/PSRule.Rules.Azure/blob/ad6ab981befdc149b22748e5e519552493b401d7/scripts/security-baseline.ps1
Description of the issue
RULE.EXCLUDE
.RULE.EXCLUDE
.As mentoined in this issue comment:
If doing
Invoke-PSRule -OutputFormat 'Json'
where all findings are excluded with-Option @{'RULE.EXCLUDE'=[string[]](<rules>)
, the command fails with errorOperationStopped: Index was outside the bounds of the array.
Seems it happens in the toJson override here:
Setting
-OutputFormat 'None'
works fine.To Reproduce
Steps to reproduce the issue:
Expected behaviour
ToString should not be called if no findings?
Module in use and version:
Additional context