Skip to content

Conversation

@alexandair
Copy link
Collaborator

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request adds a new assessment test (ID 35008) to check whether SharePoint Online's default site label capability is enabled tenant-wide. The test verifies that the DisableDocumentLibraryDefaultLabeling setting is not set to $true, which would prevent site administrators from configuring automatic baseline classification for document libraries.

Key Changes

  • New test function to assess SharePoint Online default sensitivity label configuration
  • Documentation with remediation steps for enabling the capability
  • Comprehensive unit tests covering pass, fail, and error scenarios

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
src/powershell/tests/Test-Assessment.35008.ps1 Main test implementation that queries SharePoint tenant settings and evaluates the DisableDocumentLibraryDefaultLabeling property
src/powershell/tests/Test-Assessment.35008.md Documentation describing the feature, remediation steps, and reference links
code-tests/test-assessments/Test-Assessment.35008.Tests.ps1 Pester tests validating the assessment logic for three scenarios: query errors, disabled labeling, and enabled labeling

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +54 to +59
if ($null -ne $spoTenant -and $spoTenant.DisableDocumentLibraryDefaultLabeling -eq $true) {
$passed = $false
}
else {
$passed = $true
}
Copy link

Copilot AI Dec 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic here treats any non-true value (including null or undefined) of DisableDocumentLibraryDefaultLabeling as passing. However, if the property is null or undefined, it might indicate an unexpected state or API issue rather than a legitimate "enabled" state. Consider explicitly checking for $false to ensure the property exists and is set to the expected value.

Copilot uses AI. Check for mistakes.
Comment on lines +38 to +49
It "Should return Investigate status" {
Mock Get-SPOTenant { throw "Connection error" }
Mock Add-ZtTestResultDetail {
param($TestId, $Title, $Status, $Result)
"## Scenario: Error querying settings`n`n$Result`n" | Add-Content $script:outputFile
}

Test-Assessment-35008

Should -Invoke Add-ZtTestResultDetail -ParameterFilter {
$Status -eq $false -and $Result -match "Unable to query SharePoint Tenant Settings"
}
Copy link

Copilot AI Dec 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test comment says "Should return Investigate status" but the assertion checks for "$Status -eq $false". There's an inconsistency between the comment and the actual assertion. The test is checking for a failure status, not an investigate status. Either the comment should be updated to reflect that it's checking for failure, or the assertion should be updated to match an "investigate" status if that's a distinct state in the framework.

Copilot uses AI. Check for mistakes.
Copilot AI review requested due to automatic review settings December 31, 2025 07:48
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +70 to +73
$testResultMarkdown = "✅ Default sensitivity label capability is enabled for SharePoint document libraries, allowing automatic baseline labeling.`n`n"
}
else {
$testResultMarkdown = "❌ Default sensitivity label capability is DISABLED. Site admins cannot configure library-level default labels.`n`n"
Copy link

Copilot AI Dec 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The success message states that the capability is "enabled" when the test passes. However, the test actually passes when DisableDocumentLibraryDefaultLabeling is NOT set to $true. This includes cases where the property is $false, $null, or any other value. The message should more accurately reflect what is being checked, such as "Default sensitivity label capability is not blocked" or "DisableDocumentLibraryDefaultLabeling is not set to True".

Suggested change
$testResultMarkdown = "✅ Default sensitivity label capability is enabled for SharePoint document libraries, allowing automatic baseline labeling.`n`n"
}
else {
$testResultMarkdown = "❌ Default sensitivity label capability is DISABLED. Site admins cannot configure library-level default labels.`n`n"
$testResultMarkdown = "✅ Default sensitivity label capability is not blocked for SharePoint document libraries (DisableDocumentLibraryDefaultLabeling is not set to True), allowing automatic baseline labeling.`n`n"
}
else {
$testResultMarkdown = "❌ Default sensitivity label capability is blocked at the tenant level (DisableDocumentLibraryDefaultLabeling is set to True). Site admins cannot configure library-level default labels.`n`n"

Copilot uses AI. Check for mistakes.
SfiPillar = '',
TenantType = ('Workforce'),
TestId = 35008,
Title = 'SPO Default Site Label (Tenant-Wide)',
Copy link

Copilot AI Dec 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The title "SPO Default Site Label" is inconsistent with the actual test, which checks document library default labeling, not site labeling. The test is checking DisableDocumentLibraryDefaultLabeling, which is a document library feature, not a site-level feature. Consider updating the title to better reflect the actual functionality being tested, such as "SPO Default Document Library Label (Tenant-Wide)" or "SharePoint Document Library Default Labeling".

Copilot uses AI. Check for mistakes.

$testResultDetail = @{
TestId = '35008'
Title = 'SPO Default Site Label (Tenant-Wide)'
Copy link

Copilot AI Dec 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The title "SPO Default Site Label" is inconsistent with the actual test functionality. The test checks document library default labeling, not site labeling. Consider updating the title to "SPO Default Document Library Label (Tenant-Wide)" or similar to accurately reflect what's being tested.

Copilot uses AI. Check for mistakes.
Comment on lines +73 to +90
Context "When Default Labeling is Enabled (Pass)" {
It "Should return Pass status" {
Mock Get-SPOTenant {
return [PSCustomObject]@{
DisableDocumentLibraryDefaultLabeling = $false
}
}
Mock Add-ZtTestResultDetail {
param($TestId, $Title, $Status, $Result)
"## Scenario: Default Labeling Enabled`n`n$Result`n" | Add-Content $script:outputFile
}

Test-Assessment-35008

Should -Invoke Add-ZtTestResultDetail -ParameterFilter {
$Status -eq $true -and $Result -match 'DisableDocumentLibraryDefaultLabeling: False'
}
}
Copy link

Copilot AI Dec 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test only verifies the scenario where DisableDocumentLibraryDefaultLabeling is explicitly set to $false. However, the assessment logic in the main test file also passes when the property is $null or undefined. Consider adding a test case to verify behavior when the property is null to ensure the test handles this edge case correctly.

Copilot uses AI. Check for mistakes.

To enable the default sensitivity label capability for SharePoint document libraries:
1. Verify sensitivity labels are enabled for SharePoint: `(Get-SPOTenant).EnableAIPIntegration` (must be `$true`)
2. Connect to SharePoint Online: `Connect-SPOService -Url https://<tenant>-admin.sharepoint.com`
Copy link

Copilot AI Dec 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The remediation step references a URL pattern with a placeholder <tenant> that users need to replace. Consider providing more explicit guidance that users should replace <tenant> with their actual tenant name, or use a more complete example like Connect-SPOService -Url https://contoso-admin.sharepoint.com to make it clearer.

Suggested change
2. Connect to SharePoint Online: `Connect-SPOService -Url https://<tenant>-admin.sharepoint.com`
2. Connect to SharePoint Online (replace `<tenant>` with your tenant name), for example: `Connect-SPOService -Url https://contoso-admin.sharepoint.com`

Copilot uses AI. Check for mistakes.
$passed = $false
}
else {
if ($null -ne $spoTenant -and $spoTenant.DisableDocumentLibraryDefaultLabeling -eq $true) {
Copy link

Copilot AI Dec 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The assessment logic considers null values as a passing condition. When DisableDocumentLibraryDefaultLabeling is null (property doesn't exist or is unset), the test passes. However, according to the description, the capability should be explicitly disabled (set to $false) for the test to pass. A null value should be treated as an unknown state and potentially fail the test or be investigated, as the property may not be available in all SharePoint Online configurations.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant