Fix Cannot Apply a Sensitivity Label with Its PowerShell ID
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.

- 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.
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.
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.
Run the 'Get-AIPFileStatus' cmdlet on the target file path to determine whether the file already has a sensitivity label applied.
Open PowerShell as Administrator and run 'Update-Module -Name ExchangeOnlineManagement' to install the latest EXO V2 or V3 module.
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.
Execute the 'Set-AIPFileLabel' cmdlet using the verified GUID to confirm if the updated module resolves the error.

Test Label Application Using the Office User Interface
Determine if the sensitivity label error is restricted to PowerShell by applying the label manually in an Office application.
Review Label Configuration and Publication Policies
Verify that the sensitivity label is correctly configured and actively published to the account running the PowerShell script.
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. Download the installer: Visit the official WPS Office website and click the free download button for your operating system.
- 2. Install the software: Run the downloaded installation file and follow the on-screen prompts to set up the software.
- 3. Open your files: Launch WPS Office and seamlessly open your existing .docx, .xlsx, or .pptx files.

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.




