New-AzureSqlDatabaseDataMaskingRule
New-AzureSqlDatabaseDataMaskingRule
Creates a data masking rule for an Azure SQL database.
Syntax
Parameter Set: Default
New-AzureSqlDatabaseDataMaskingRule [-ResourceGroupName] <System.String> [-ServerName] <System.String> [-DatabaseName] <System.String> -ColumnName <System.String> -MaskingFunction <System.String> {NoMasking | Default | Text | Number | SocialSecurityNumber | CreditCardNumber | Email} -RuleId <System.String> -SchemaName <System.String> -TableName <System.String> [-NumberFrom <Nullable [System.Double]> ] [-NumberTo <Nullable [System.Double]> ] [-PassThru] [-PrefixSize <Nullable [System.UInt32]> ] [-Profile <Microsoft.Azure.Common.Authentication.Models.AzureProfile> ] [-ReplacementString <System.String> ] [-SuffixSize <Nullable [System.UInt32]> ]
Detailed Description
The New-AzureSqlDatabaseDataMaskingRule cmdlet is used to create a data masking rule in an Azure SQL database. To use the cmdlet, use the ResourceGroupName, ServerName, DatabaseName, and RuleId parameters to identify the rule. Provide the SchemaNameTableName 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 as well as the rule identifiers. Rule identifiers include, but are not limited to, ResourceGroupName, ServerName, DatabaseName, and RuleID.
Parameters
-ColumnName<System.String>
Specifies the name of the column that is the target of this masking rule.
Aliases |
none |
Required? |
true |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
true(ByPropertyName) |
Accept Wildcard Characters? |
false |
-DatabaseName<System.String>
Specifies the name of the database.
Aliases |
none |
Required? |
true |
Position? |
3 |
Default Value |
none |
Accept Pipeline Input? |
true(ByPropertyName) |
Accept Wildcard Characters? |
false |
-MaskingFunction<System.String>
Specifies the masking function that the rule uses. Valid values are:
-- Default
-- NoMasking
-- Text
-- Number
-- SocialSecurityNumber
-- CreditCardNumber
-- Email
The default value is Default.
Aliases |
none |
Required? |
true |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
true(ByPropertyName) |
Accept Wildcard Characters? |
false |
-NumberFrom<Nullable [System.Double]>
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.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
true(ByPropertyName) |
Accept Wildcard Characters? |
false |
-NumberTo<Nullable [System.Double]>
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.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
true(ByPropertyName) |
Accept Wildcard Characters? |
false |
-PassThru
Returns an object representing the item with which you are working. By default, this cmdlet does not generate any output.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-PrefixSize<Nullable [System.UInt32]>
Specifies the number of characters in the beginning of the text that is not masked. Specify this parameter only if you specify a value of Text for the MaskingFunction parameter. The default value is 0.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
true(ByPropertyName) |
Accept Wildcard Characters? |
false |
-Profile<Microsoft.Azure.Common.Authentication.Models.AzureProfile>
Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-ReplacementString<System.String>
Specifies the number of characters in the end of the text that is not masked. Specify this parameter only if you specify a value of Text for the MaskingFunction parameter. The default value is 0.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
true(ByPropertyName) |
Accept Wildcard Characters? |
false |
-ResourceGroupName<System.String>
Specifies the name of the resource group that contains the database.
Aliases |
none |
Required? |
true |
Position? |
1 |
Default Value |
none |
Accept Pipeline Input? |
true(ByPropertyName) |
Accept Wildcard Characters? |
false |
-RuleId<System.String>
Specifies the identifier for the data masking rule.
Aliases |
none |
Required? |
true |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
true(ByPropertyName) |
Accept Wildcard Characters? |
false |
-SchemaName<System.String>
Aliases |
none |
Required? |
true |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
true(ByPropertyName) |
Accept Wildcard Characters? |
false |
-ServerName<System.String>
Specifies the name of the server that contains the database.
Aliases |
none |
Required? |
true |
Position? |
2 |
Default Value |
none |
Accept Pipeline Input? |
true(ByPropertyName) |
Accept Wildcard Characters? |
false |
-SuffixSize<Nullable [System.UInt32]>
Specifies the number of characters in the end of the text that is not masked. Specify this parameter only if you specify a value of Text for the MaskingFunction parameter. The default value is 0.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
true(ByPropertyName) |
Accept Wildcard Characters? |
false |
-TableName<System.String>
Specifies the name of the table in the database of which the masked column is part.
Aliases |
none |
Required? |
true |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
true(ByPropertyName) |
Accept Wildcard Characters? |
false |
Inputs
The input type is the type of the objects that you can pipe to the cmdlet.
- None
Outputs
The output type is the type of the objects that the cmdlet emits.
- Microsoft.Azure.Commands.Sql.Security.Model.DatabaseDataMaskingRuleModel
Notes
- This cmdlet supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer, PipelineVariable, and OutVariable. For more information, see about_CommonParameters.
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 Column22 in the table named Table01 in the schema named Schema31. Database03 contains all these elements. The rule is a number masking rule that uses a random number between 5 and 14 as the masked value. The rule is named Rule17.
PS C:\> Set-AzureSqlDatabaseDataMaskingRule -ResourceGroupName "ResourceGroup11" -ServerName "Server01" -DatabaseName "Database03" –RuleId "Rule17" –SchemaName "Schema31" –TableName "Table01" –ColumnName "Column22" –MaskingFunction Number –NumberFrom 5 –NumberTo 14
Related topics
Get-AzureSqlDatabaseDataMaskingRule
Remove-AzureSqlDatabaseDataMaskingRule