How to Block Password-Protected Files with Microsoft 365 DLP
Question details
The user needs to configure a Data Loss Prevention (DLP) rule in Microsoft 365 to detect and restrict access to encrypted or password-protected attachments.

- Product
- Microsoft 365
- Device & OS
- not provided
- Scenario
- Setting up organizational security policies to prevent data leaks via files that bypass standard DLP content inspection due to encryption.
- Observed behavior
- Microsoft 365 DLP can inspect ordinary files but fails to read password-protected ones, requiring a specialized rule to detect the encryption state and restrict access.
Ensure you have the necessary administrative privileges in the Microsoft 365 Compliance Center to create, modify, and manage Data Loss Prevention (DLP) policies.
Configure a DLP Rule for Password-Protected Attachments
Create a specific condition in your DLP policy that triggers an action whenever an attachment is encrypted or password-protected.
Because Microsoft 365 DLP cannot scan the internal contents of encrypted files, setting a rule to restrict access to these specific files ensures that sensitive information cannot intentionally or accidentally bypass your organization's security filters.
Log in to the Microsoft 365 Compliance Center, navigate to your Data loss prevention (DLP) policies, and select 'Use advanced settings' for the policy you wish to edit.
Choose 'New rule' to start defining the specific conditions for encrypted files.
In the conditions section, add the criteria 'Attachment is password protected'.
Scroll down to the 'Actions' section and select 'Restrict access or encrypt the content' to enforce a block on these files.
Save the rule and test the policy by sending both an unprotected Excel file and a password-protected file to confirm that the restrictions behave exactly as expected.

Secure Your Documents Locally with WPS Office
While Microsoft 365 handles enterprise-level data loss prevention, you can easily secure your individual files using WPS Office. It provides robust document encryption and serves as a highly compatible, free alternative to Microsoft Office.
- 1. Download WPS Office: Install WPS Office for free from the official website and open your document.
- 2. Access Document Encryption: Go to the 'Menu' button in the top left corner, navigate to 'Document Encryption', and select 'Encryption'.
- 3. Set a Password: Enter your desired password to secure the file locally before sharing it with others.

Frequently Asked Questions
Why does Microsoft 365 DLP fail to inspect password-protected files?
Password-protected and encrypted files scramble the content, preventing the DLP scanning engine from reading the text to check for sensitive information matches. Therefore, a specialized rule must be used to detect the encryption state itself.
Can I apply this DLP rule to specific users or groups only?
Yes, when configuring your DLP policy in the Microsoft 365 Compliance Center, you can specify exact conditions and exceptions to apply the restriction rule only to certain departments, domains, or individual users.
How do I test my DLP rule without affecting users?
You can set the DLP policy to 'Test it out first' mode. This allows the system to evaluate rules and generate incident reports behind the scenes without actually blocking emails or restricting user access.




