HI @jeremie bedard ,
Thank you for reaching out to SQL forum
SQL Server Management Studio (SSMS) lets you import a custom policy file through its user interface, which is why your French-language patterns appear correctly when using the “Classify Data” task. However, the PowerShell cmdlet Get-SqlSensitivityRecommendations is hardwired to use the default policy defined in Microsoft Purview (formerly Azure Information Protection) and doesn’t recognize or reference the custom policy file you imported into SSMS. It also doesn’t offer any parameter to override this behavior, which means your custom rules won’t be applied when using the cmdlet.
To work around the limitations of Get-SqlSensitivityRecommendations, you can start by using SSMS for initial classification import your custom policy file, classify the data manually, and then export the results to a .csv or .json file for further processing. From there, you can use PowerShell to automate validation or apply additional logic. Since you've already scripted column sampling and pattern matching, another option is to build your own classification logic directly in PowerShell by defining regex-based rules that reflect your custom policy, scanning columns manually with Invoke-Sqlcmd, and tagging matches using Set-SqlSensitivityClassification. If your organization uses Microsoft Purview, you can define custom sensitivity labels and classification rules centrally, which will be respected by both SSMS and PowerShell though this approach requires Azure integration and admin privileges.
If you have any questions or need further clarification, please don’t hesitate to reach out.
We appreciate your collaboration and support!
Best regards,
Lakshmi.