microsoft / PSRule

Validate infrastructure as code (IaC) and objects using PowerShell rules.
https://microsoft.github.io/PSRule/v2/
MIT License
385 stars 49 forks source link

Export summary to CSV rendered null #486

Closed vicperdana closed 4 years ago

vicperdana commented 4 years ago

Description of the issue

When running the Invoke-PSRule command to output summary to a csv file, no result was exported apart from the headers.

To Reproduce

Steps to reproduce the issue:

Invoke-PSRule -InputPath .\*.json -Module PSRule.Rules.Azure -As Summary -OutputFormat Csv -OutputPath "resultsSummary.csv"

Expected behaviour

Expect to receive below output (albeit in CSV format) - this command was run to simulate the behavior with no outputformat defined.

Invoke-PSRule -InputPath .\*.json -Module PSRule.Rules.Azure -As Summary
RuleName                            Pass  Fail  Outcome
--------                            ----  ----  -------
Azure.Automation.EncryptVariables   2     0     Pass
Azure.Automation.WebHookExpiry      2     0     Pass
Azure.Resource.UseTags              39    40    Fail
Azure.ResourceGroup.Name            1     0     Pass
Azure.RBAC.UseGroups                0     1     Fail
Azure.RBAC.LimitOwner               0     1     Fail
Azure.RBAC.LimitMGDelegation        1     0     Pass
Azure.RBAC.CoAdministrator          1     0     Pass
Azure.RBAC.UseRGDelegation          0     1     Fail
Azure.SecurityCenter.Contact        0     1     Fail
Azure.SecurityCenter.Provisioning   0     1     Fail
Azure.Monitor.ServiceHealth         0     1     Fail

Error output

Capture any error messages and or verbose messages with -Verbose.

There's no error message received with Verbose

Module in use and version:

Captured output from $PSVersionTable:

Name                           Value
----                           -----
PSVersion                      5.1.18362.752
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.18362.752
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Additional context

N/A

BernieWhite commented 4 years ago

@vicperdana Thanks for reporting this issue.