question

KoteswararaoKata-4343 avatar image
0 Votes"
KoteswararaoKata-4343 asked LucasLiu-MSFT commented

How to export a existing DLP Policy schema and create a policy based on this schema using Power shell?

Hi Team, We want to export a existing custom dlp policy schema and need to create a dlp policy based on the schema using powershell. Any suggestions or ideas over the possibilities?

office-exchange-online-itpro
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

michev avatar image
0 Votes"
michev answered KoteswararaoKata-4343 commented

Your best bet is the Export-DlpPolicyCollection cmdlet: https://docs.microsoft.com/en-us/powershell/module/exchange/export-dlppolicycollection?view=exchange-ps
You can also take a look at M365 DSC, which includes DLP policies configuration: https://github.com/microsoft/Microsoft365DSC

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi Michev,

Thanks for your quick reply, we have tried Export-DlpPolicyCollection as well. but unfortunately not working. Tried the below code snippet as resultant below xml schema got exported to xml file at given location.

$file = Export-DlpPolicyCollection
Set-Content -Path "C:\My Documents\Contoso PII.xml" -Value $file.FileData -Encoding Byte

Result:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<dlpPolicies />

Though our policy containing multiple rules and actions, nothing was exporting.

Also when ever there is a change in any particular DLP policy we have to apply the same changes to the policies created based on this particular policy template using PowerShell, can you help over this scenario as well.










0 Votes 0 ·
LucasLiu-MSFT avatar image
0 Votes"
LucasLiu-MSFT answered LucasLiu-MSFT commented

Hi @KoteswararaoKata-4343 ,
Please try to create a new DLP policy in Exchange admin center and try to run the above command again. Then check to see if the correct XML file is exported.

At present, I have not found a command line to update all DLP policies that apply the same custom template at the same time. I will continue to search and research, and I will update if there are any findings.



If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.



· 4
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi LucasLiu-MSFT,

Thanks for your quick help.

Export-DlpPolicyCollection only working to export the exchange level DLP Policy, But in our case we want to export Office 365 Security and Compliance center DLP Policy as template.

Any idea over the same, your help must appreciated.

Regards
Koteswararao

0 Votes 0 ·
LucasLiu-MSFT avatar image LucasLiu-MSFT KoteswararaoKata-4343 ·

Hi @KoteswararaoKata-4343 ,
According to my test, you could following the steps in the below link to connect to Security & Compliance Center PowerShell, then run the following command to export the DLP policy in Office 365 Security and Compliance center.

 $file = Export-DlpPolicyCollection
 Set-Content -Path <> -Value $file.FileData -Encoding Byte

Please refer to: Connect to Security & Compliance Center PowerShell



If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.




0 Votes 0 ·

Hi @KoteswararaoKata-4343 ,
Do suggestions above help? If the issue has been resolved, please click “Accept as answer” to mark helpful reply as an answer, this will make answer searching in the forum easier and be beneficial to other community members as well.

Thanks for your understanding.



If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 Votes 0 ·

Hi @KoteswararaoKata-4343 ,
I am writing here to confirm with you how thing going now?



If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 Votes 0 ·