diff --git a/CHANGELOG.md b/CHANGELOG.md index 07f9a82..e6d91da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/source/Classes/CISAuditResult.ps1 b/source/Classes/CISAuditResult.ps1 index 2cc80fd..fcc5be0 100644 --- a/source/Classes/CISAuditResult.ps1 +++ b/source/Classes/CISAuditResult.ps1 @@ -1,4 +1,5 @@ class CISAuditResult { + [string]$M365AuditVersion [string]$Status [string]$ELevel [string]$ProfileLevel diff --git a/source/Private/Initialize-CISAuditResult.ps1 b/source/Private/Initialize-CISAuditResult.ps1 index 66adf73..4c2e895 100644 --- a/source/Private/Initialize-CISAuditResult.ps1 +++ b/source/Private/Initialize-CISAuditResult.ps1 @@ -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 diff --git a/source/Public/Export-M365SecurityAuditTable.ps1 b/source/Public/Export-M365SecurityAuditTable.ps1 index 83d489e..f6354f6 100644 --- a/source/Public/Export-M365SecurityAuditTable.ps1 +++ b/source/Public/Export-M365SecurityAuditTable.ps1 @@ -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) { diff --git a/source/Public/Invoke-M365SecurityAudit.ps1 b/source/Public/Invoke-M365SecurityAudit.ps1 index 13fa0b9..7ac823f 100644 --- a/source/Public/Invoke-M365SecurityAudit.ps1 +++ b/source/Public/Invoke-M365SecurityAudit.ps1 @@ -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