Skip to content

Update Get-LabelPolicy to use WarningAction SilentlyContinue#914

Merged
merill merged 1 commit intomicrosoft:mainfrom
alexandair:alex-forcevalidate-fix
Mar 2, 2026
Merged

Update Get-LabelPolicy to use WarningAction SilentlyContinue#914
merill merged 1 commit intomicrosoft:mainfrom
alexandair:alex-forcevalidate-fix

Conversation

@alexandair
Copy link
Collaborator

Update Get-LabelPolicy to use -WarningAction SilentlyContinue and suppress unwanted "Force Validate not set" warning.

Copy link
Contributor

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

Updates sensitivity label assessment tests to suppress a noisy warning emitted by Get-LabelPolicy, keeping test output clean while still failing on real errors via -ErrorAction Stop.

Changes:

  • Add -WarningAction SilentlyContinue to Get-LabelPolicy calls in multiple sensitivity label tests.
  • Preserve existing error handling behavior (try/catch with -ErrorAction Stop) while suppressing warnings.

Reviewed changes

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

Show a summary per file
File Description
src/powershell/tests/Test-Assessment.35018.ps1 Suppresses Get-LabelPolicy warnings during enabled-policy retrieval.
src/powershell/tests/Test-Assessment.35017.ps1 Suppresses Get-LabelPolicy warnings during enabled-policy retrieval.
src/powershell/tests/Test-Assessment.35016.ps1 Suppresses Get-LabelPolicy warnings during enabled-policy retrieval.
src/powershell/tests/Test-Assessment.35015.ps1 Suppresses Get-LabelPolicy warnings during enabled-policy retrieval.
src/powershell/tests/Test-Assessment.35014.ps1 Suppresses Get-LabelPolicy warnings during enabled-policy retrieval.
src/powershell/tests/Test-Assessment.35004.ps1 Suppresses Get-LabelPolicy warnings during policy retrieval.

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

Copy link
Collaborator

@merill merill left a comment

Choose a reason for hiding this comment

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

LGTM

@merill merill merged commit 2704f08 into microsoft:main Mar 2, 2026
8 checks passed
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.

3 participants