How to Fix Error 400 When Deleting an Exchange Quarantine Policy
Question details
The user is unable to edit or delete a quarantine policy in the Microsoft 365 portal due to a status code 400 error.

- Product
- Exchange Online
- Device & OS
- not provided
- Scenario
- Attempting to manage or remove an existing quarantine policy via the Microsoft 365 web portal.
- Observed behavior
- The portal blocks the action and returns a status code 400 error along with a DirectInvokeCmdletExecutionException, regardless of the browser or device used.
Ensure that your Microsoft 365 account has the required administrative permissions, such as the Organization Management or Security Administrator role, before attempting to manage quarantine policies.
Remove Policy Assignments and References
Error 400 often occurs because the quarantine policy is actively assigned to users, groups, or referenced by another security policy (like a spam filter), which prevents deletion.
Exchange Online prevents the deletion of quarantine policies that are still in use to avoid breaking existing security rules. You must manually unlink the policy from all associated filters and user assignments.
Navigate to the Microsoft 365 Defender portal, review the quarantine policy settings, and remove any assigned users or groups.
Open your Anti-spam or Anti-malware policy settings. If the quarantine policy you wish to delete is selected as the default action for quarantined messages, change it to a different policy.
Once all assignments and references have been cleared, return to the Quarantine policies page and attempt to delete the policy again.

Force Deletion Using Exchange Online PowerShell
If the Microsoft 365 web portal continues to fail, you can use Exchange Online PowerShell to execute the deletion command directly.
Experience a Seamless and Free Microsoft Office Alternative
While resolving Exchange Online server errors requires deep administrative troubleshooting, handling your daily documents shouldn't be complicated. WPS Office provides a powerful, lightweight, and completely free alternative to Microsoft Office.
- 1. Download the Installer: Visit the official WPS Office website and click the free download button for your operating system.
- 2. Install WPS Office: Run the downloaded installer file and follow the simple on-screen instructions to complete the setup.
- 3. Open and Edit Your Files: Launch WPS Office and instantly open your existing Word, Excel, or PowerPoint documents without losing any formatting.

Frequently Asked Questions
What causes a DirectInvokeCmdletExecutionException in Microsoft 365?
This exception usually occurs when a backend PowerShell command fails to execute through the web portal interface. It is often triggered by dependency conflicts, such as attempting to delete a quarantine policy that is still actively referenced by anti-spam or anti-malware rules.
Do I need special permissions to delete an Exchange quarantine policy?
Yes, you must be assigned appropriate administrative roles to modify or delete quarantine policies in Exchange Online. Typical roles that include these permissions are Organization Management or Security Administrator.
Can I delete a quarantine policy if it is linked to a spam filter?
No, Exchange Online prevents the deletion of a quarantine policy if it is currently associated with an active spam filter or anti-malware policy. You must first edit the linked policy and remove the association before you can successfully delete the quarantine policy.




