fix: Refactor Initialize-CISAuditResult to use global test definitions

This commit is contained in:
DrIOS
2024-05-28 19:25:27 -05:00
parent b064f9f271
commit 290540b25a
2 changed files with 3 additions and 3 deletions

View File

@@ -17,8 +17,7 @@ function Initialize-CISAuditResult {
)
# Import the test definitions CSV file
$testDefinitionsPath = Join-Path -Path $PSScriptRoot -ChildPath "helper/TestDefinitions.csv"
$testDefinitions = Import-Csv -Path $testDefinitionsPath
$testDefinitions = $script:TestDefinitionsObject
# Find the row that matches the provided recommendation (Rec)
$testDefinition = $testDefinitions | Where-Object { $_.Rec -eq $Rec }

View File

@@ -161,7 +161,8 @@ function Invoke-M365SecurityAudit {
# Load test definitions from CSV
$testDefinitionsPath = Join-Path -Path $PSScriptRoot -ChildPath "helper\TestDefinitions.csv"
$testDefinitions = Import-Csv -Path $testDefinitionsPath
# Load the Test Definitions into the script scope for use in other functions
$script:TestDefinitionsObject = $testDefinitions
# Apply filters based on parameter sets
switch ($PSCmdlet.ParameterSetName) {
'ELevelFilter' {