Test-DbaDbDataMaskingConfig
View SourceSynopsis
Validates data masking configuration JSON files for structural and logical errors
Description
Validates data masking configuration JSON files by checking column properties, data types, masking types, and action configurations against dbatools requirements.
Returns detailed error information for any tables and columns that fail validation, helping you identify configuration issues before running data masking operations.
Checks include required/allowed column properties, supported SQL Server data types, valid masking and subtype combinations, date range validations, and action property requirements.
Essential for troubleshooting complex masking configurations and ensuring they’ll execute successfully without runtime errors.
Syntax
Test-DbaDbDataMaskingConfig
[-FilePath] <String>
[-EnableException]
[<CommonParameters>]
Examples
Example: 1
PS > Test-DbaDbDataMaskingConfig -FilePath C:\temp_datamasking\db1.json
Test the configuration file
Required Parameters
-FilePath
Specifies the full path to the data masking configuration JSON file to validate.
Use this to verify your masking configuration before running New-DbaDbDataMaskingConfig or Invoke-DbaDbDataMasking to catch errors early.
| Property | Value |
|---|---|
| Alias | |
| Required | True |
| Pipeline | false |
| Default Value |
Optional Parameters
-EnableException
By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.
This avoids overwhelming you with “sea of red” exceptions, but is inconvenient because it basically disables advanced scripting.
Using this switch turns this “nice by default” feature off and enables you to catch exceptions with your own try/catch.
| Property | Value |
|---|---|
| Alias | |
| Required | False |
| Pipeline | false |
| Default Value | False |
Outputs
PSCustomObject
Returns validation error objects for any configuration issues found. If the configuration file is valid with no errors, no output is returned.
Each error object contains the following properties:
- Table (string): Name of the table in the configuration where the error was found
- Column (string): Name of the column in the table where the error was found
- Value (string): The problematic value or comma-separated list of property names causing the error
- Error (string): Description of the validation error encountered
Common validation errors include:
- Missing required column properties (Action, CharacterString, ColumnType, Composite, Deterministic, Format, MaskingType, MaxValue, MinValue, Name, Nullable, KeepNull, SubType)
- Invalid column data types (unsupported by SQL Server or dbatools)
- Invalid masking types or subtypes (not available in dbatools randomization library)
- Unsupported action categories, types, or subcategories
- Invalid date range values or missing required min/max values for ‘Between’ subtype
- Missing required action properties (Category, Type, Value for datetime actions; Category, Type, Value for number actions)
- Action category incompatibility with column data type
- Additional properties in columns that are not in the allowed properties list
dbatools