SHELL/7.2.3.ps1
|
$CheckId = "7.2.3" $Title = "Ensure external content sharing is restricted" $Level = "L1" $BenchmarkType = "Automated" $AllowedValues = @( "ExternalUserSharingOnly", "ExistingExternalUserSharingOnly", "Disabled" ) try { $TenantConfig = Get-SPOTenant -ErrorAction Stop $SharingCapability = [string]$TenantConfig.SharingCapability $Pass = $AllowedValues -contains $SharingCapability $Status = if ($Pass) { "PASS" } else { "FAIL" } [pscustomobject]@{ CheckId = $CheckId Title = $Title Level = $Level BenchmarkType = $BenchmarkType Status = $Status Pass = $Pass Evidence = [pscustomobject]@{ SharingCapability = $SharingCapability AllowedValues = $AllowedValues SourceDocument = "CIS_Microsoft_365_Foundations_Benchmark_v6.0.1" } Error = if ($Pass) { $null } else { "SharingCapability is set to '$SharingCapability'. It must be ExternalUserSharingOnly, ExistingExternalUserSharingOnly, or Disabled." } Timestamp = Get-Date } } catch { [pscustomobject]@{ CheckId = $CheckId Title = $Title Level = $Level BenchmarkType = $BenchmarkType Status = "ERROR" Pass = $null Evidence = [pscustomobject]@{ AllowedValues = $AllowedValues SourceDocument = "CIS_Microsoft_365_Foundations_Benchmark_v6.0.1" } Error = $_.Exception.Message Timestamp = Get-Date } } |