The Set-AzSqlDatabaseDataMaskingRule cmdlet sets a data masking rule for an Azure SQL database.
To use the cmdlet, provide the ResourceGroupName, ServerName, DatabaseName, and RuleId parameters to identify the rule.
You can provide any of the parameters of SchemaName, TableName, and ColumnName to retarget the rule.
Specify the MaskingFunction parameter to modify how the data is masked.
If you specify a value of Number or Text for MaskingFunction, you can specify the NumberFrom and NumberTo parameters for number masking or the PrefixSize, ReplacementString, and SuffixSize parameters for text masking.
If the command succeeds, and if you specify the PassThru parameter, the cmdlet returns an object that describes the data masking rule properties and 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: Change the range of a data masking rule in a database
This command modifies a data masking rule that has the ID Rule17.
That rule operates in the database named Database01 on server Server01.
This command changes the boundaries for the interval in which a random number is generated as the masked value.
The new range is between 23 and 42.
Example 2
Sets the properties of a data masking rule for a database. (autogenerated)
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 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.
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.