fix: 7.2.1 aligned with test-template
This commit is contained in:
@@ -1,13 +1,14 @@
|
|||||||
function Test-ModernAuthSharePoint {
|
function Test-ModernAuthSharePoint {
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
param (
|
param (
|
||||||
|
# Aligned
|
||||||
# Define your parameters here
|
# Define your parameters here
|
||||||
)
|
)
|
||||||
|
|
||||||
begin {
|
begin {
|
||||||
# Initialization code
|
# Dot source the class script if necessary
|
||||||
|
#. .\source\Classes\CISAuditResult.ps1
|
||||||
$auditResult = [CISAuditResult]::new()
|
# Initialization code, if needed
|
||||||
}
|
}
|
||||||
|
|
||||||
process {
|
process {
|
||||||
@@ -15,7 +16,18 @@ function Test-ModernAuthSharePoint {
|
|||||||
$SPOTenant = Get-SPOTenant | Select-Object -Property LegacyAuthProtocolsEnabled
|
$SPOTenant = Get-SPOTenant | Select-Object -Property LegacyAuthProtocolsEnabled
|
||||||
$modernAuthForSPRequired = -not $SPOTenant.LegacyAuthProtocolsEnabled
|
$modernAuthForSPRequired = -not $SPOTenant.LegacyAuthProtocolsEnabled
|
||||||
|
|
||||||
# Populate the auditResult object with the required properties
|
# Prepare failure reasons and details based on compliance
|
||||||
|
$failureReasons = if (-not $modernAuthForSPRequired) {
|
||||||
|
"Legacy authentication protocols are enabled"
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
"N/A"
|
||||||
|
}
|
||||||
|
|
||||||
|
$details = "LegacyAuthProtocolsEnabled: $($SPOTenant.LegacyAuthProtocolsEnabled)"
|
||||||
|
|
||||||
|
# Create and populate the CISAuditResult object
|
||||||
|
$auditResult = [CISAuditResult]::new()
|
||||||
$auditResult.CISControlVer = "v8"
|
$auditResult.CISControlVer = "v8"
|
||||||
$auditResult.CISControl = "3.10"
|
$auditResult.CISControl = "3.10"
|
||||||
$auditResult.CISDescription = "Encrypt Sensitive Data in Transit"
|
$auditResult.CISDescription = "Encrypt Sensitive Data in Transit"
|
||||||
@@ -27,13 +39,13 @@ function Test-ModernAuthSharePoint {
|
|||||||
$auditResult.IG3 = $true
|
$auditResult.IG3 = $true
|
||||||
$auditResult.RecDescription = "Modern Authentication for SharePoint Applications"
|
$auditResult.RecDescription = "Modern Authentication for SharePoint Applications"
|
||||||
$auditResult.Result = $modernAuthForSPRequired
|
$auditResult.Result = $modernAuthForSPRequired
|
||||||
$auditResult.Details = "LegacyAuthProtocolsEnabled: $($SPOTenant.LegacyAuthProtocolsEnabled)"
|
$auditResult.Details = $details
|
||||||
$auditResult.FailureReason = if (-not $modernAuthForSPRequired) { "Legacy authentication protocols are enabled" } else { "N/A" }
|
$auditResult.FailureReason = $failureReasons
|
||||||
$auditResult.Status = if ($modernAuthForSPRequired) { "Pass" } else { "Fail" }
|
$auditResult.Status = if ($modernAuthForSPRequired) { "Pass" } else { "Fail" }
|
||||||
}
|
}
|
||||||
|
|
||||||
end {
|
end {
|
||||||
# Return auditResult
|
# Return the audit result
|
||||||
return $auditResult
|
return $auditResult
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user