Error running Invoke-PSRule #1722
Replies: 2 comments 4 replies
-
@paulmcclbg Haven't seen that error before. Are you using a PSRule v2.9.0 or another version? Maybe try What is the content of the JSON file? If it is an ARM template or compiled Bicep file use |
Beta Was this translation helpful? Give feedback.
-
@paulmcclbg Ok I can reproduce that. It's a bug. It's an issue with the default formatter view. Logged as #1723. I think this would only be affecting if you are manually running the cmdlet, and in Pester it may not be an issue. To work around it append a select for the fields you are after, for example: Invoke-PSRule -InputPath ./test-sample-1.json -Module PSRule.Rules.Azure | Select-Object RuleName, Outcome, Recommendation |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
If I run the following:
Assert-PSRule -InputPath ./test-sample-1.json -Module PSRule.Rules.Azure
then the command runs fine and I get rule results outputted to the terminal (8 passed, 2 failed)
As soon as I change to
Invoke-PSRule -InputPath ./test-sample-1.json -Module PSRule.Rules.Azure
I get this error:
format-default: Cannot process argument because the value of argument "name" is not valid. Change the value of the "name" argument and run the operation again.
Can you please explain ? I want to use Invoke-PSRule due to invokation through Pester.
Note: Test-PSRuleTarget also runs fine and returns False.
Beta Was this translation helpful? Give feedback.
All reactions