fix: Refactor Initialize-CISAuditResult to use global test definitions
This commit is contained in:
@@ -17,8 +17,7 @@ function Initialize-CISAuditResult {
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Import the test definitions CSV file
|
# Import the test definitions CSV file
|
||||||
$testDefinitionsPath = Join-Path -Path $PSScriptRoot -ChildPath "helper/TestDefinitions.csv"
|
$testDefinitions = $script:TestDefinitionsObject
|
||||||
$testDefinitions = Import-Csv -Path $testDefinitionsPath
|
|
||||||
|
|
||||||
# Find the row that matches the provided recommendation (Rec)
|
# Find the row that matches the provided recommendation (Rec)
|
||||||
$testDefinition = $testDefinitions | Where-Object { $_.Rec -eq $Rec }
|
$testDefinition = $testDefinitions | Where-Object { $_.Rec -eq $Rec }
|
||||||
|
@@ -161,7 +161,8 @@ function Invoke-M365SecurityAudit {
|
|||||||
# Load test definitions from CSV
|
# Load test definitions from CSV
|
||||||
$testDefinitionsPath = Join-Path -Path $PSScriptRoot -ChildPath "helper\TestDefinitions.csv"
|
$testDefinitionsPath = Join-Path -Path $PSScriptRoot -ChildPath "helper\TestDefinitions.csv"
|
||||||
$testDefinitions = Import-Csv -Path $testDefinitionsPath
|
$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
|
# Apply filters based on parameter sets
|
||||||
switch ($PSCmdlet.ParameterSetName) {
|
switch ($PSCmdlet.ParameterSetName) {
|
||||||
'ELevelFilter' {
|
'ELevelFilter' {
|
||||||
|
Reference in New Issue
Block a user