Get Data Masking Rule

 

Returns the details for an Azure SQL Database’s dynamic data masking rule.

Request

See Common parameters and headers for headers and parameters that are used by all SQL Database requests.

Method

Request URI

GET

https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/Microsoft.Sql/servers/{server-name}/databases/{database-name}/dataMasking/Default/rules/{rule-id}?api-version={api-version}

URI Parameters

None.

Request Headers

Standard request headers.

Request Body

None.

Response

The response includes an HTTP status code, a set of response headers, and a response body.

Status Code

200 OK - indicates the request completed successfully.

For more information about status codes, see Status and Error Codes.

Response Headers

Standard response headers.

Response Body

The format of the response body is as follows:

{
    "id": "{Identifier of the data masking rule}",
    "name": "Default",
    "type": "Microsoft.Sql/servers/databases/dataMaskingPolicies/rules",
    "Location": "East US",
    "properties": {
         "id": "tbl_col",
         "ruleState": "Enabled",
         "tableName": "tbl",
         "columnName": "col",
         "aliasName": null,
         "maskingFunction": "SSN",
         "numberFrom": "0",
         "numberTo": "20",
         "prefixSize": "2",
         "suffixSize": "2",
         "replacementString: "X"
        }
}

The following table describes the elements of the response body:

Element Name

Description

id

A unique identifier for this rule.

ruleState

The state of the data masking rule. Possible values are:

  • Enabled

  • Disabled

tableName

The name of the database entity to which this rule applies. E.g. table name, view name. If this is not null, column name must be not null, and alias must be null.If additional rules exist; the URL of the next rule in the ordered list of rules.

columnName

The name of the column this rule is masking.

aliasName

The alias to which this rule should apply. If alias is not null, tableName and columnName must be null.

maskingFunction

The type of the field being masked. Possible values are:

  • NoMasking

  • Default

  • Text

  • Number

  • SSN

  • CCN

  • Email

numberFrom

For "Number" masking function this specifies the lower bound of the random number replacement

numberTo

For "Number" masking function this specifies the upper bound of the random number replacement

prefixSize

For "Text" masking function this specifies the number of characters to show unmasked in the beginning of the string.

suffixSize

For "Text" masking function this specifies the number of characters to show unmasked at the end of the string.

replacementString

For "Text" masking function this specifies the character to use for masking the unexposed part of the string.

Other Responses

404 Not Found – indicates that the rule does not exist.

409 Conflict - indicates the request did not complete successfully due to conflict in storage account details.

See Also

Get started with SQL Database Dynamic Data Masking
Azure SQL Database
Operations for Azure SQL Databases
Azure SQL Database Cmdlets