Skip to content

How to export rules severity, pillar and pillar subcategory #1986

Answered by BernieWhite
jsporbert asked this question in Q&A
Discussion options

You must be logged in to vote

The list of columns in the built-in CSV output method is not configurable. There is a issue over here to make this more customizable microsoft/PSRule#1165.

For results, you could call Invoke-PSRule and Select-Object to expose the specific columns you are looking for.

Invoke-PSRule -f . -Format File -Outcome Fail | Select-Object RuleName, @{ Name = "Severity"; Expression = { $_.Info.Annotations.severity }}, @{ Name = "Pillar"; Expression = { $_.Info.Annotations.pillar }} | ConvertTo-Csv | Set-Content -Path out.csv

For exporting the pillar and severity data for merging in you could use Get-PSRule to export details for each rule:

 Get-PSRule -Module PSRule.Rules.Azure | Select-Object RuleName, 

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
1 reply
@jsporbert
Comment options

Answer selected by BernieWhite
Comment options

You must be logged in to vote
1 reply
@BernieWhite
Comment options

Comment options

You must be logged in to vote
1 reply
@BernieWhite
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants