'Within' keyword with '-Reason' parameter is not working #1116
Answered
by
BernieWhite
ankur90Git
asked this question in
Q&A
-
I am using 'Within' keyword inside a rule along with parameter '-Reason' to pass the custom message on failure. But in the output the reason is blank for the failed rule. How can I get the custom failure message in the results? # Synopsis: key FUNCTIONS_EXTENSION_VERSION must have value of pattern '~1'
Rule 'FUNCTIONS_EXTENSION_VERSION1' {
AllOf {
Exists 'ApplicationSettings.FUNCTIONS_EXTENSION_VERSION' -CaseSensitive -Reason 'field not present'
Match 'ApplicationSettings.FUNCTIONS_EXTENSION_VERSION' '7' -Reason 'value not matching as expected'
}
} Invoke-PSRule -Path $rulePath -InputPath $inputPath -OutputFormat wide |
Beta Was this translation helpful? Give feedback.
Answered by
BernieWhite
Jun 18, 2022
Replies: 1 comment
-
@ankur90Git Yes this is an issue with The reason is there but there is an issue with wide view which is preventing the display of the property. A temporary workaround would be: Invoke-PSRule -Path $rulePath -InputPath $inputPath -OutputFormat wide | Format-Table RuleName,Outcome,@{ Name = 'Reason'; Expression = { $_.Reason } },Recommendation |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
ankur90Git
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@ankur90Git Yes this is an issue with
Invoke-PSRule
thanks for reporting the issue. I've logged it as a bug #1117.The reason is there but there is an issue with wide view which is preventing the display of the property.
A temporary workaround would be: