Here in this Office 365 tutorial we will discuss how to resolve DLP Policy Stuck Deleting issue in Security & Compliance Center in Office 365. We will see how we can delete DLP policy in Office 365 using PowerShell.
Recently when I check Office 365 security & compliance center, I saw there was a policy which was showing Status as Deleting but it is stuck.
In the background, the policy was running and it was deleting the documents from various SharePoint sites.
When I try to delete the DLP Policy from the Security & Compliance Center, it was not deleting and giving below error.
Request: /api/policy?policyType=Dlp&identity=a14a5b5c-8000-44af-9972-df2cd66cffaf
Status code: 500
Exception message: {“Message”:”We cannot remove policy \u0027DLPPolicy1\u0027 since it is already in pending deletion state.”,”DiagnosticContext”:”{Version:16.00.2887.002,Environment:SEAPROD,DeploymentId:baab341de8c64fbebbaf7c782ead5db5,InstanceId:WebRole_IN_1,SID:3f911acd-c0e0-493f-a44f-0ba07adc2810,CID:c79db8f7-e9de-4f1c-b9a2-92f068e00c6c}”,”Time”:”2019-02-24T17:41:38.1432154Z”,”ExceptionType”:”Microsoft.Exchange.PswsClient.PswsException”}
Diagnostic information: **{Version:16.00.2887.002,Environment:SEAPROD,DeploymentId:baab341de8c64fbebbaf7c782ead5db5,InstanceId:WebRole_IN_2,SID:3f911acd-c0e0-493f-a44f-0ba07adc2810,CID:d590b08c-1a14-42df-b3f4-5d97b7b19089}
Time: 2019-02-24T17:41:57.851Z
So I deleted the DLP policy using PowerShell.
Delete DLP Policy using PowerShell in Office 365
If you are new to PowerShell, you can read an article on Working with PowerShell in SharePoint Online/2016/2013.
Below is the PowerShell Script to delete DLP Policy from Office 365 Security & Compliance Center.
You can write the PowerShell script in Visual studio code or Windows PowerShell ISE.
$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.compliance.protection.outlook.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
Import-PSSession $Session
Get-DlpCompliancePolicy
Remove-DlpCompliancePolicy "DLPPolicy1" -ForceDeletion
Once you run the command, the DLP policy will be deleted from Office 365 Security & Compliance Center.
Similarly, if you want to retrieve all the DLP Policies from Office 365 Security & Compliance Center.
Get-DlpCompliancePolicy
You may like following Office 365 tutorials:
- Create Bulk Users in Office 365 (from CSV File)
- Delete site collection in SharePoint Online Office 365 and SharePoint 2013/2016/2019
- SharePoint Online Office 365 enable or disable user account
- How to Customize Office 365 login page SharePoint Online
- What is Shared mailbox in Office 365? How to create and access SharePoint mailbox in Office 365?
- Set Password never expires for Office 365 SharePoint Users
- Join Office 365 Developer Program and Get One Year FREE Office 365 Developer Subscription
- Steps to Migrate email from one Office 365 tenant to another Office 365 tenant
- Why Companies are Switching from Google Apps to Office 365
- Office 365 Export – Take 100% Backup Office 365 Mailbox to PST Easily
- Office 365 Import Tool Perfect Option for PST to Office 365 Migration
Hope this SharePoint tutorial helps to resolve Office 365 DLP Policy Stuck Deleting Security & Compliance Center issue.
We saw how we can delete DLP policy using PowerShell in Office 365 Security & Compliance Center.
I am Bijay from Odisha, India. Currently working in my own venture TSInfo Technologies in Bangalore, India. I am Microsoft Office Servers and Services (SharePoint) MVP (5 times). I works in SharePoint 2016/2013/2010, SharePoint Online Office 365 etc. Check out My MVP Profile.. I also run popular SharePoint web site EnjoySharePoint.com
This command no longer has a force option