add: Core logic to switch between versions

This commit is contained in:
DrIOS
2024-12-24 15:51:03 -06:00
parent ca021695a4
commit 5753ab8a4f
6 changed files with 67 additions and 43 deletions

View File

@@ -296,6 +296,7 @@ function Get-CISExoOutput {
return $spamPolicies
}
'2.1.7' {
# v4 needs same info.
# Test-AntiPhishingPolicy.ps1
<#
$antiPhishPolicies = @(
@@ -340,9 +341,6 @@ function Get-CISExoOutput {
$antiPhishPolicies = Get-AntiPhishPolicy
return $antiPhishPolicies
}
'2.1.7-v4' {
# Placeholder Test-AntiPhishingPolicy.ps1
}
'2.1.9' {
# Test-EnableDKIM.ps1
# 2.1.9 (L1) Ensure DKIM is enabled for all Exchange Online Domains

View File

@@ -38,15 +38,12 @@ function Get-CISMgOutput {
Write-Verbose "Get-CISMgOutput: Returning data for Rec: $Rec"
switch ($rec) {
'1.1.1' {
# V4 needs same info
# 1.1.1 - MicrosoftGraphPlaceholder
# Test-AdministrativeAccountCompliance
$AdminRoleAssignmentsAndUsers = Get-AdminRoleUserAndAssignment
return $AdminRoleAssignmentsAndUsers
}
'1.1.1-v4' {
# 1.1.1-v4 - MicrosoftGraphPlaceholder
# Placeholder for the new v4 logic for Test-AdministrativeAccountCompliance
}
'1.1.4' {
# 1.1.4 - MicrosoftGraphPlaceholder
# Placeholder for Test-AdminAccountLicenses
@@ -61,7 +58,7 @@ function Get-CISMgOutput {
}
'1.2.1' {
# Test-ManagedApprovedPublicGroups
$allGroups = Get-MgGroup -All | Where-Object { $_.Visibility -eq "Public" } | Select-Object DisplayName, Visibility
$allGroups = Get-MgGroup -All | Where-Object { $_.Visibility -eq 'Public' } | Select-Object DisplayName, Visibility
return $allGroups
}
'1.2.2' {
@@ -94,7 +91,7 @@ function Get-CISMgOutput {
'6.1.2' {
# Test-MailboxAuditingE3
$tenantSKUs = Get-MgSubscribedSku -All
$e3SkuPartNumber = "SPE_E3"
$e3SkuPartNumber = 'SPE_E3'
$foundE3Sku = $tenantSKUs | Where-Object { $_.SkuPartNumber -eq $e3SkuPartNumber }
if ($foundE3Sku.Count -ne 0) {
$allE3Users = Get-MgUser -Filter "assignedLicenses/any(x:x/skuId eq $($foundE3Sku.SkuId) )" -All
@@ -107,7 +104,7 @@ function Get-CISMgOutput {
'6.1.3' {
# Test-MailboxAuditingE5
$tenantSKUs = Get-MgSubscribedSku -All
$e5SkuPartNumber = "SPE_E5"
$e5SkuPartNumber = 'SPE_E5'
$foundE5Sku = $tenantSKUs | Where-Object { $_.SkuPartNumber -eq $e5SkuPartNumber }
if ($foundE5Sku.Count -ne 0) {
$allE5Users = Get-MgUser -Filter "assignedLicenses/any(x:x/skuId eq $($foundE5Sku.SkuId) )" -All

View File

@@ -25,8 +25,8 @@ function Invoke-TestFunction {
if ('ApprovedFederatedDomains' -in $functionCmd.Parameters.Keys) {
$paramList.ApprovedFederatedDomains = $ApprovedFederatedDomains
}
# Use splatting to pass parameters
Write-Verbose "Running $functionName..."
# Version-aware logging
Write-Verbose "Running $functionName (Version: $($script:Version400 ? '4.0.0' : '3.0.0'))..."
try {
$result = & $functionName @paramList
# Assuming each function returns an array of CISAuditResult or a single CISAuditResult