Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to get more output details like resourceGroup #1625

Open
mschwrdtnr opened this issue Sep 21, 2023 · 5 comments
Open

Add option to get more output details like resourceGroup #1625

mschwrdtnr opened this issue Sep 21, 2023 · 5 comments
Labels
enhancement New feature or request

Comments

@mschwrdtnr
Copy link

mschwrdtnr commented Sep 21, 2023

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.

@mschwrdtnr mschwrdtnr added the enhancement New feature or request label Sep 21, 2023
@github-actions
Copy link
Contributor

Thanks for raising your first issue, the team appreciates the time you have taken 😉

@mschwrdtnr
Copy link
Author

mschwrdtnr commented Sep 21, 2023

It would also be nice to add the following outputs based on the rule:

@mschwrdtnr
Copy link
Author

@BernieWhite I would be happy if you can give me any hints how I can add a 'ResourceGroup' column in other ways.

@BernieWhite
Copy link
Member

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.

@Leandroesc
Copy link

I would also love the feature to export the subscription information when collecting data for more than one subscription.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants