fix: 2.1.5 aligned with test-template

This commit is contained in:
DrIOS
2024-05-28 14:29:09 -05:00
parent d1a5cb8d73
commit dbc577bc67

View File

@@ -1,16 +1,19 @@
function Test-SafeAttachmentsTeams { function Test-SafeAttachmentsTeams {
[CmdletBinding()] [CmdletBinding()]
param ( param (
# Aligned
# Parameters can be added if needed # Parameters can be added if needed
) )
begin { begin {
# Dot source the class script if necessary
$auditResults = @() #. .\source\Classes\CISAuditResult.ps1
# Initialization code, if needed
} }
process { process {
# Requires E5 license # 2.1.5 (L2) Ensure Safe Attachments for SharePoint, OneDrive, and Microsoft Teams is Enabled
# Retrieve the ATP policies for Office 365 and check Safe Attachments settings # Retrieve the ATP policies for Office 365 and check Safe Attachments settings
$atpPolicies = Get-AtpPolicyForO365 $atpPolicies = Get-AtpPolicyForO365
@@ -25,12 +28,19 @@ function Test-SafeAttachmentsTeams {
$result = $null -ne $atpPolicyResult $result = $null -ne $atpPolicyResult
$details = if ($result) { $details = if ($result) {
"ATP for SharePoint, OneDrive, and Teams is enabled with correct settings." "ATP for SharePoint, OneDrive, and Teams is enabled with correct settings."
} else { }
else {
"ATP for SharePoint, OneDrive, and Teams is not enabled with correct settings." "ATP for SharePoint, OneDrive, and Teams is not enabled with correct settings."
} }
$failureReason = if ($result) { "N/A" } else { "ATP policy for SharePoint, OneDrive, and Microsoft Teams is not correctly configured." }
# Create an instance of CISAuditResult and populate it $failureReasons = if ($result) {
"N/A"
}
else {
"ATP policy for SharePoint, OneDrive, and Microsoft Teams is not correctly configured."
}
# Create and populate the CISAuditResult object
$auditResult = [CISAuditResult]::new() $auditResult = [CISAuditResult]::new()
$auditResult.Status = if ($result) { "Pass" } else { "Fail" } $auditResult.Status = if ($result) { "Pass" } else { "Fail" }
$auditResult.ELevel = "E5" $auditResult.ELevel = "E5"
@@ -45,13 +55,13 @@ function Test-SafeAttachmentsTeams {
$auditResult.IG3 = $true $auditResult.IG3 = $true
$auditResult.Result = $result $auditResult.Result = $result
$auditResult.Details = $details $auditResult.Details = $details
$auditResult.FailureReason = $failureReason $auditResult.FailureReason = $failureReasons
$auditResults += $auditResult
} }
end { end {
# Return auditResults # Return the audit result
return $auditResults return $auditResult
} }
} }
# Additional helper functions (if any)