fix: 7.2.4 aligned with test-template
This commit is contained in:
@@ -1,41 +1,58 @@
|
|||||||
function Test-OneDriveContentRestrictions {
|
function Test-OneDriveContentRestrictions {
|
||||||
[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 {
|
||||||
# 7.2.4 (L2) Ensure OneDrive content sharing is restricted
|
# 7.2.4 (L2) Ensure OneDrive content sharing is restricted
|
||||||
|
|
||||||
|
# Retrieve OneDrive sharing capability settings
|
||||||
$SPOTenant = Get-SPOTenant | Select-Object OneDriveSharingCapability
|
$SPOTenant = Get-SPOTenant | Select-Object OneDriveSharingCapability
|
||||||
$isOneDriveSharingRestricted = $SPOTenant.OneDriveSharingCapability -eq 'Disabled'
|
$isOneDriveSharingRestricted = $SPOTenant.OneDriveSharingCapability -eq 'Disabled'
|
||||||
|
|
||||||
# Populate the auditResult object with the required properties
|
# Prepare failure reasons and details based on compliance
|
||||||
|
$failureReasons = if (-not $isOneDriveSharingRestricted) {
|
||||||
|
"OneDrive content sharing is not restricted to 'Disabled'. Current setting: $($SPOTenant.OneDriveSharingCapability)"
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
"N/A"
|
||||||
|
}
|
||||||
|
|
||||||
|
$details = if ($isOneDriveSharingRestricted) {
|
||||||
|
"OneDrive content sharing is restricted."
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
"OneDriveSharingCapability: $($SPOTenant.OneDriveSharingCapability)"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Create and populate the CISAuditResult object
|
||||||
|
$auditResult = [CISAuditResult]::new()
|
||||||
|
$auditResult.Status = if ($isOneDriveSharingRestricted) { "Pass" } else { "Fail" }
|
||||||
|
$auditResult.ELevel = "E3"
|
||||||
|
$auditResult.ProfileLevel = "L2"
|
||||||
|
$auditResult.Rec = "7.2.4"
|
||||||
|
$auditResult.RecDescription = "Ensure OneDrive content sharing is restricted"
|
||||||
$auditResult.CISControlVer = "v8"
|
$auditResult.CISControlVer = "v8"
|
||||||
$auditResult.CISControl = "3.3"
|
$auditResult.CISControl = "3.3"
|
||||||
$auditResult.CISDescription = "Configure Data Access Control Lists"
|
$auditResult.CISDescription = "Configure Data Access Control Lists"
|
||||||
|
|
||||||
$auditResult.Rec = "7.2.4"
|
|
||||||
$auditResult.ELevel = "E3"
|
|
||||||
$auditResult.ProfileLevel = "L2"
|
|
||||||
$auditResult.IG1 = $true
|
$auditResult.IG1 = $true
|
||||||
$auditResult.IG2 = $true
|
$auditResult.IG2 = $true
|
||||||
$auditResult.IG3 = $true
|
$auditResult.IG3 = $true
|
||||||
$auditResult.RecDescription = "Ensure OneDrive content sharing is restricted"
|
|
||||||
|
|
||||||
$auditResult.Result = $isOneDriveSharingRestricted
|
$auditResult.Result = $isOneDriveSharingRestricted
|
||||||
$auditResult.Details = "OneDriveSharingCapability: $($SPOTenant.OneDriveSharingCapability)"
|
$auditResult.Details = $details
|
||||||
$auditResult.FailureReason = if (-not $isOneDriveSharingRestricted) { "OneDrive content sharing is not restricted to 'Disabled'. Current setting: $($SPOTenant.OneDriveSharingCapability)" } else { "N/A" }
|
$auditResult.FailureReason = $failureReasons
|
||||||
$auditResult.Status = if ($isOneDriveSharingRestricted) { "Pass" } else { "Fail" }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
end {
|
end {
|
||||||
# Return auditResult
|
# Return auditResult
|
||||||
return $auditResult
|
return $auditResult
|
||||||
}
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user