Data Protection Issues

Fix Cannot Apply a Sensitivity Label with Its PowerShell ID

Phi Hung VoPhi Hung Vo Nov 4, 2026 869 views

Question details

The user is unable to apply sensitivity labels to files using their PowerShell identifier (GUID), despite the labels being successfully created and published in the tenant.

How to Fix 'Cannot Apply a Sensitivity Label' Using Its PowerShell ID
Product
Microsoft Purview Information Protection / Exchange Online
Device & OS
not provided
Scenario
Automating data protection by applying sensitivity labels via PowerShell scripts.
Observed behavior
Applying a label using the identifier returned by PowerShell produces an error. The failure may occur with a single specific label or affect all labels across the tenant.
Before you start

Ensure you have the appropriate administrator privileges to manage sensitivity labels and verify that your tenant has Multifactor Authentication (MFA) properly configured for PowerShell access.

Solution 1Recommended

Verify Existing File Status and Update the PowerShell Module

Check if a conflicting label is already applied and ensure you are using the latest Exchange Online PowerShell module to avoid GUID recognition errors.

Outdated PowerShell modules often fail to process newly created sensitivity label GUIDs correctly, or fail when modern authentication (MFA) requirements are strictly enforced. Additionally, files may already have an existing label that prevents a new one from being applied.

1
Check current file status

Run the 'Get-AIPFileStatus' cmdlet on the target file path to determine whether the file already has a sensitivity label applied.

2
Update Exchange Online module

Open PowerShell as Administrator and run 'Update-Module -Name ExchangeOnlineManagement' to install the latest EXO V2 or V3 module.

3
Retrieve and isolate GUIDs

Run 'Get-Label' to retrieve the identifiers of several different labels in your tenant. Test applying different labels to isolate whether the issue is with a single label or affects all of them.

4
Test label application

Execute the 'Set-AIPFileLabel' cmdlet using the verified GUID to confirm if the updated module resolves the error.

Verify Existing File Status and Update the PowerShell Module
Modern Authentication Required: If Multifactor Authentication (MFA) is enabled, ensure your script authenticates correctly using modern authentication flows or app-based authentication, rather than legacy credentials.
Free Microsoft Office alternative

Simplify Your Document Workflow with WPS Office

Enterprise-level data protection and PowerShell administration can be complex. If you need a straightforward, hassle-free way to create, edit, and manage your everyday documents without expensive subscriptions or complicated configurations, WPS Office is the perfect solution.

  1. 1. Download the installer: Visit the official WPS Office website and click the free download button for your operating system.
  2. 2. Install the software: Run the downloaded installation file and follow the on-screen prompts to set up the software.
  3. 3. Open your files: Launch WPS Office and seamlessly open your existing .docx, .xlsx, or .pptx files.
Completely free and lightweight office suiteHigh format compatibility with Microsoft Word, Excel, and PowerPointFamiliar user interface requiring zero learning curveBuilt-in PDF editing and basic document encryption features
microsoft office alternative - wps office

Frequently Asked Questions

How do I find the correct PowerShell ID for a sensitivity label?

You can find the PowerShell ID (GUID) by connecting to Security & Compliance PowerShell and executing the 'Get-Label' cmdlet. The returned list will display the names and corresponding GUIDs of all available labels.

Why does Get-AIPFileStatus show a different label than I expected?

The file may have inherited a default label from a SharePoint document library, or another user might have applied a label manually before your script was executed. Default label policies can also automatically assign a label upon file creation.

How long does it take for a newly published label to be available in PowerShell?

It can take up to 24 hours for new or modified sensitivity labels and publication policies to fully synchronize across all Microsoft 365 services, endpoints, and PowerShell modules.

Does Multifactor Authentication (MFA) block label application via PowerShell?

Yes. If your PowerShell script attempts to run using legacy authentication in a tenant where MFA is enforced, the command will fail. You must use the latest EXO module that supports modern authentication, or configure certificate-based authentication for automated scripts.