dbatools icon indicating copy to clipboard operation
dbatools copied to clipboard

Invoke-DbaDbDataMasking not honoring "Persisted" property value on config file

Open ClaudioESSilva opened this issue 4 years ago • 5 comments

Report

After generating a DataMaskingConfig file we can edit it to change some property values. I was recently playing with the Deterministic property, which uses the same masked value on all matches.

Assume I have the persisted property of the JSON config file with the value of "true".

  1. When my config has just one column, the persisted value is honoured, and the values being masked are equal. ✔️
  2. IF my config file has 2 columns (both with the persisted property set to true, none of them is honoured. ❌

Host used

  • [x] powershell.exe
  • [x] VS Code

Errors Received

No errors.

Steps to Reproduce

  1. Generate a new config with 2 columns
New-DbaDbMaskingConfig -SqlInstance localhost -Database AdventureWorksLT2016 -Table Address -Column City, PostalCode -Path "d:\temp"
  1. Edit the generated configuration file and change the persisted property to true on both occurrences.
  2. Use the saved config file on Invoke-DbaDbDataMasking
Invoke-DbaDbDataMasking -SqlInstance localhost -Database AdventureWorksLT2016 -FilePath "D:\temp\localhost.AdventureWorksLT2016.DataMaskingConfig.json"

Expected Behavior

Anonymized values should be equal when values were equal before.

Actual Behavior

Each record is getting a value.

image

Environmental information

PowerShell Version : 5.1.19041.1023 dbatools latest installed : 1.0.168 Culture of OS : en-US

SQL Server:

Microsoft SQL Server 2016
us_english

ClaudioESSilva avatar Jul 06 '21 11:07 ClaudioESSilva

@sanderstad do you have time to take a look? Thanks!

ClaudioESSilva avatar Jul 06 '21 11:07 ClaudioESSilva

@ClaudioESSilva Can you include the config you're using? I have a little trouble with my docker installation so I can't really run the command to get the config

sanderstad avatar Jul 07 '21 19:07 sanderstad

Sorry for the delay @sanderstad

Here is the example I'm trying to use.

{
    "Name":  "AdventureWorksLT2016",
    "Type":  "DataMaskingConfiguration",
    "Tables":  [
                   {
                       "Name":  "Address",
                       "Schema":  "SalesLT",
                       "Columns":  [
                                       {
                                           "Name":  "City",
                                           "ColumnType":  "nvarchar",
                                           "CharacterString":  null,
                                           "MinValue":  15,
                                           "MaxValue":  30,
                                           "MaskingType":  "Address",
                                           "SubType":  "City",
                                           "Format":  null,
                                           "Separator":  null,
                                           "Deterministic":  true,
                                           "Nullable":  false,
                                           "KeepNull":  true,
                                           "Composite":  null,
                                           "Action":  null,
                                           "StaticValue":  null
                                       },
                                       {
                                           "Name":  "PostalCode",
                                           "ColumnType":  "nvarchar",
                                           "CharacterString":  null,
                                           "MinValue":  8,
                                           "MaxValue":  15,
                                           "MaskingType":  "Address",
                                           "SubType":  "Zipcode",
                                           "Format":  null,
                                           "Separator":  null,
                                           "Deterministic":  true,
                                           "Nullable":  false,
                                           "KeepNull":  true,
                                           "Composite":  null,
                                           "Action":  null,
                                           "StaticValue":  null
                                       }
                                   ],
                       "HasUniqueIndex":  true,
                       "FilterQuery":  null
                   }
               ]
}

ClaudioESSilva avatar Jul 25 '21 10:07 ClaudioESSilva

🚧🚨 This issue is being marked as stale due to 90 days of inactivity. If you would like this issue to remain open:

  • Verify the issue/bug is reproduced in the latest version of the module
  • Verify the environmental info provided is still accurate
  • Add any additional steps you followed to reproduce if necessary 🚨🚧 ⌛️ This issue will be closed in 30 days ⌛️

github-actions[bot] avatar Oct 24 '21 06:10 github-actions[bot]

This got a bit stale. So let me bring this issue to you attention again...

andreasjordan avatar Jun 10 '23 14:06 andreasjordan