Run masking
Published 03 November 2024
With the masking-options.json file now created, the masking step can be ran to anonymize the data in the database.
rganonymize mask --database-engine SqlServer --connection-string "[connection string]" --options-file masking-options.json --masking-file masking.json
This takes the masking-options.json and masking.json files as input and masks the data in the database based on the combination of the information contained in them.
The resultant applied masking configuration is:
{
"tables": [
{
"schema": "dbo",
"name": "Customers",
"columns": [
{
"name": "CompanyName",
"dataset": "CompanyNames",
"maxLength": 40
},
{
"name": "ContactName",
"dataset": "FullNames",
"deterministic": true,
"maxLength": 30
}
]
},
{
"schema": "dbo",
"name": "Shippers",
"columns": [
{
"name": "CompanyName",
"dataset": "CompanyNames",
"maxLength": 40
}
]
},
{
"schema": "dbo",
"name": "Suppliers",
"columns": [
{
"name": "CompanyName",
"dataset": "CompanyNames",
"maxLength": 40
},
{
"name": "ContactName",
"dataset": "FamilyNames",
"deterministic": true,
"maxLength": 30
},
{
"name": "ContactTitle",
"dataset": "JobTitles"
},
{
"name": "HomePage",
"dataset": "Websites",
"preserveNulls": true,
"maxLength": 20
}
]
},
{
"schema": "dbo",
"name": "Territories",
"columns": [
{
"name": "TerritoryDescription",
"dataset": "Cities"
}
]
}
],
"datasets": [
{
"name": "CompanyNames",
"type": "List",
"values": [ "Redgate Software", "Microsoft", "Google", "Amazon", "Apple", "Facebook", "Twitter" ]
},
{
"name": "JobTitles",
"type": "List",
"values": [ "CEO", "CTO", "Director", "Engineer", "Developer", "Designer", "Analyst", "Consultant" ]
},
{
"name": "Websites",
"type": "List",
"values": [ "https://www.example.com", "https://www.test.com", "https://www.google.com" ]
}
],
"settings": {
"dateTimeFormats": [
"YYYY-MM-dd",
"yyyy-mm-dd HH:mm:ss"
]
}
}Lines 3-57 show the configuration from the masking.json file.
Lines 62-65 show custom masking (A).
Lines 70-74 show a custom dataset (B).
Lines 75-84 show custom datasets from the masking.json file.
Lines 87-90 show custom date/time formats (C).