add: Version number to test output

This commit is contained in:
DrIOS
2025-04-21 11:57:40 -05:00
parent e2ab71f1a8
commit 55a4ec4bea
5 changed files with 7 additions and 5 deletions

View File

@@ -24,6 +24,7 @@ The format is based on and uses the types of changes according to [Keep a Change
- Pre-Test cmdlet call to `Get-MgGroup` to load the MgGraph assembly prior to running PnP PowerShell commands when using app authentication.
- Output Verbosity for test score.
- Get-TestDefinition private function for v4.0.0 to get the test definition for the test.
- CIS M365 Foundations version to output object to ensure tests display the version of the benchmark being used and for use in verifying the test definitions needed for the export function.
### Fixed

View File

@@ -1,4 +1,5 @@
class CISAuditResult {
[string]$M365AuditVersion
[string]$Status
[string]$ELevel
[string]$ProfileLevel

View File

@@ -20,7 +20,7 @@ function Initialize-CISAuditResult {
[Parameter(ParameterSetName = 'Error')]
[switch]$Failure
)
$M365AuditVersion = $Script:CISVersion
# Import the test definitions CSV file
$testDefinitions = $script:TestDefinitionsObject
@@ -45,6 +45,7 @@ function Initialize-CISAuditResult {
$auditResult.Automated = [bool]::Parse($testDefinition.Automated)
$auditResult.Connection = $testDefinition.Connection
$auditResult.CISControlVer = 'v8'
$auditResult.M365AuditVersion = $M365AuditVersion
if ($PSCmdlet.ParameterSetName -eq 'Full') {
$auditResult.Result = $Result

View File

@@ -87,7 +87,7 @@ function Export-M365SecurityAuditTable {
)
Begin {
# Load v4.0 definitions
$Version = '4.0.0'
$AuditResults[0].M365AuditVersion
$script:TestDefinitionsObject = Get-TestDefinition -Version $Version
# Ensure Excel support if requested
if ($ExportToExcel) {

View File

@@ -194,10 +194,9 @@ function Invoke-M365SecurityAudit {
# Ensure MgGraph assemblies are loaded prior to running PnP cmdlets
Get-MgGroup -Top 1 -ErrorAction SilentlyContinue | Out-Null
}
# Define a function to load and merge test definitions
$Script:CISVersion = $Version
# Call the function to load and merge test definitions
$testDefinitions = Get-TestDefinitions -Version $Version
$testDefinitions = Get-TestDefinition -Version $Version
# Load the Test Definitions into the script scope for use in other functions
$script:TestDefinitionsObject = $testDefinitions
# Apply filters based on parameter sets