Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 9, 2026

The global policy detection logic was only checking ExchangeLocation for 'All' scope, missing globally-scoped policies that target SharePoint, OneDrive, or ModernGroup locations.

Changes:

  • Check all four location properties (ExchangeLocation, ModernGroupLocation, SharePointLocation, OneDriveLocation) for 'All' scope
  • Detect policies with no location scoping (all locations empty), which apply globally by default
  • Align with the pattern used in Test-Assessment.35004.ps1

Before:

$globalPolicies = $labelPolicies | Where-Object {
    ($_.ExchangeLocation -contains 'All') -or
    ((-not $_.ModernGroupLocation -or $_.ModernGroupLocation.Count -eq 0) -and
     (-not $_.ExchangeLocation -or $_.ExchangeLocation.Count -eq 0))
}

After:

$globalPolicies = $labelPolicies | Where-Object {
    ($_.ExchangeLocation    -contains 'All') -or
    ($_.ModernGroupLocation -contains 'All') -or
    ($_.SharePointLocation  -contains 'All') -or
    ($_.OneDriveLocation    -contains 'All') -or
    (
        (-not $_.ModernGroupLocation  -or $_.ModernGroupLocation.Count  -eq 0) -and
        (-not $_.ExchangeLocation     -or $_.ExchangeLocation.Count     -eq 0) -and
        (-not $_.SharePointLocation   -or $_.SharePointLocation.Count   -eq 0) -and
        (-not $_.OneDriveLocation     -or $_.OneDriveLocation.Count     -eq 0)
    )
}

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Add global scope label count test for security assessment Fix incomplete global policy scope detection in Test-Assessment.35015 Jan 9, 2026
Copilot AI requested a review from Manoj-Kesana January 9, 2026 10:43
@Manoj-Kesana Manoj-Kesana marked this pull request as ready for review January 9, 2026 10:49
@Manoj-Kesana Manoj-Kesana merged commit 9da9862 into Feature-35015 Jan 9, 2026
1 check passed
@Manoj-Kesana Manoj-Kesana deleted the copilot/sub-pr-758 branch January 9, 2026 10:49
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.

2 participants