fix: pre test call
This commit is contained in:
@@ -21,6 +21,8 @@ The format is based on and uses the types of changes according to [Keep a Change
|
||||
- Adds new CSV for PowerShell commands and updates PnP update check handling
|
||||
- Introduces a new CSV file listing various PowerShell commands for different Microsoft services.
|
||||
- Updates the `Invoke-M365SecurityAudit` script to temporarily disable PnP PowerShell update checks during execution and restores the original setting afterward.
|
||||
- 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.
|
||||
|
||||
### Fixed
|
||||
|
||||
|
@@ -18,8 +18,8 @@ function Measure-AuditResult {
|
||||
$passPercentage = if ($totalTests -eq 0) { 0 } else { [math]::Round(($passedTests / $totalTests) * 100, 2) }
|
||||
|
||||
# Display the pass percentage to the user
|
||||
Write-Information "Audit completed. $passedTests out of $totalTests tests passed."
|
||||
Write-Information "Your passing percentage is $passPercentage%."
|
||||
Write-Verbose "Audit completed. $passedTests out of $totalTests tests passed."
|
||||
Write-Verbose "Your passing percentage is $passPercentage%."
|
||||
|
||||
# Display details of failed tests
|
||||
if ($FailedTests.Count -gt 0) {
|
||||
|
@@ -225,11 +225,13 @@ function Invoke-M365SecurityAudit {
|
||||
}
|
||||
}
|
||||
elseif ($script:PnpAuth = $true) {
|
||||
# Ensure MgGraph assemblies are loaded prior to running PnP cmdlets
|
||||
Get-MgGroup -Top 1 -ErrorAction SilentlyContinue | Out-Null
|
||||
}
|
||||
# Load test definitions from CSV
|
||||
$testDefinitionsPath = Join-Path -Path $PSScriptRoot -ChildPath 'helper\TestDefinitions.csv'
|
||||
$testDefinitions = Import-Csv -Path $testDefinitionsPath
|
||||
# ################ Check for $Version -eq '4.0.0' ################
|
||||
if ($Version -eq '4.0.0') {
|
||||
$script:Version400 = $true
|
||||
$testDefinitionsV4Path = Join-Path -Path $PSScriptRoot -ChildPath 'helper\TestDefinitions-v4.0.0.csv'
|
||||
|
Reference in New Issue
Block a user