The New-AzSqlDatabaseDataMaskingRule cmdlet creates a data masking rule for an Azure SQL database.
To use the cmdlet, use the ResourceGroupName, ServerName, and DatabaseName parameters to identify the rule.
Provide the TableName and ColumnName to specify the target of the rule and the MaskingFunction parameter to define how the data is masked.
If MaskingFunction has a value of Number or Text, you can specify the NumberFrom and NumberTo parameters, for number masking, or the PrefixSize, ReplacementString, and SuffixSize for text masking.
If the command succeeds and the PassThru parameter is used, the cmdlet returns an object describing the data masking rule properties in addition to the rule identifiers.
Rule identifiers include, but are not limited to, ResourceGroupName, ServerName, DatabaseName, and RuleID.
This cmdlet is also supported by the SQL Server Stretch Database service on Azure.
Examples
Example 1: Create a data masking rule for a number column in a database
This command creates a data masking rule for the column named Column01 in the table named Table01 in the schema named Schema01.
The database named Database01 contains all these items.
The rule is a number masking rule that uses a random number between 5 and 14 as the mask value.
Parameters
-ColumnName
Specifies the name of the column targeted by the masking rule.
Specifies the lower bound number of the interval from which a random value is selected.
Specify this parameter only if you specify a value of Number for the MaskingFunction parameter.
The default value is 0.
Specifies the upper bound number of the interval from which a random value is selected.
Specify this parameter only if you specify a value of Number for the MaskingFunction parameter.
The default value is 0.
Specifies the number of characters at the start of the text that are not masked.
Specify this parameter only if you specify a value of Text for the MaskingFunction parameter.
The default value is 0.
Specifies the number of characters in the end of the text that are not masked.
Specify this parameter only if you specify a value of Text for the MaskingFunction parameter.
The default value is an empty string.
Specifies the number of characters at the end of the text that are not masked.
Specify this parameter only if you specify a value of Text for the MaskingFunction parameter.
The default value is 0.
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,
-InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable,
-ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see
about_CommonParameters.
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.