SHELL/7.2.7.ps1
|
$CheckId = "7.2.7" $Title = "Ensure link sharing is restricted in SharePoint and OneDrive" $Level = "L1" $BenchmarkType = "Automated" $AllowedValues = @("Direct", "Internal") try { $TenantConfig = Get-SPOTenant -ErrorAction Stop $DefaultSharingLinkType = [string]$TenantConfig.DefaultSharingLinkType $Pass = $AllowedValues -contains $DefaultSharingLinkType $Status = if ($Pass) { "PASS" } else { "FAIL" } [pscustomobject]@{ CheckId = $CheckId Title = $Title Level = $Level BenchmarkType = $BenchmarkType Status = $Status Pass = $Pass Evidence = [pscustomobject]@{ DefaultSharingLinkType = $DefaultSharingLinkType AllowedValues = $AllowedValues SourceDocument = "CIS_Microsoft_365_Foundations_Benchmark_v6.0.1" } Error = if ($Pass) { $null } else { "DefaultSharingLinkType is '$DefaultSharingLinkType'. It must be Direct or Internal." } 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 } } |