Add option to get more output details like resourceGroup
mschwrdtnr opened this issue · comments
Is your feature request related to a problem? Please describe.
I am currently using the tool to check against different azure environments and export the results as csv. There are different options when run Invoke-PSRule
, see https://microsoft.github.io/PSRule/v2/concepts/PSRule/en-US/about_PSRule_Options/#outputformat. It's possible to get a summary and a detailed output. The detailed output only includes the following columns RuleName, TargetName, TargetType, Outcome, OutcomeReason, Synopsis, Recommendation
while the json scan includes more information such as Subscription, Resource Group, Location and so on.
The current output details are not detailed enough for me and doesn't allow to sort or filter for resource groups. That's make it hard when having many subscriptions and resource groups.
Describe the solution you'd like
I want to have an option where I can specify more output details such as resource group, subscription and location.
Describe alternatives you've considered
Alternatives can be to use suppression. But these are only allow run against different target types and not resource groups.
Additional context
I would be happy about alternatives to face the problem.
Thanks for raising your first issue, the team appreciates the time you have taken 😉
It would also be nice to add the following outputs based on the rule:
Severity
Pillar
Category
like already mentioned in #1165
@BernieWhite I would be happy if you can give me any hints how I can add a 'ResourceGroup' column in other ways.
Hi @mschwrdtnr most of the detail is already present and is available under the .Info
or .Filed
properties. So can be formatted with Select-Object
and passed to ConvertTo-Csv
.
Invoke-PSRule -m psrule.rules.azure -f .\export02\ -as Detail `
| Select-Object TargetName, RuleName, Ref, @{ Name = 'Severity'; Expression = { $_.Info.Annotations.severity } }, @{ Name = 'ResourceGroup'; Expression = { $_.Field.resourceGroupName } } `
| ConvertTo-Csv
Although I did find an bug where resourceGroupName
is not populated correctly, but we should be able to fix this for v1.30.0 which is due very soon.
But yes the plan is to make this configurable.
We are working toward this with PSRule v3, and will release a preview in the next month or so. Final release would be closer to the end of the year or Q1 next year.
I would also love the feature to export the subscription information when collecting data for more than one subscription.