Classification Rules - Create Or Replace

Creates or replaces a classification rule.

PUT {endpoint}/scan/classificationrules/{classificationRuleName}?api-version=2023-09-01

URI Parameters

Name In Required Type Description
classificationRuleName
path True

string

The classification rule name.

Regex pattern: ^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$

endpoint
path True

string

url

The scanning endpoint of your purview account. Example: https://{accountName}.purview.azure.com.

api-version
query True

string

The api version to use.

Request Body

The request body can be one of the following:

Name Description
CustomClassificationRule

Rule of custom classification.

SystemClassificationRule

The rule of system classification.

CustomClassificationRule

Rule of custom classification.

Name Required Type Description
kind True string:

Custom

The kind of classification rule.

properties

CustomClassificationRuleProperties

The properties of custom classification rule.

SystemClassificationRule

The rule of system classification.

Name Required Type Description
kind True string:

System

The kind of classification rule.

properties

SystemClassificationRuleProperties

The properties of system classification rule.

Responses

Name Type Description
200 OK ClassificationRule:

Success.

201 Created ClassificationRule:

Success.

Other Status Codes

ErrorResponseModel

An error response received from the Scanning Service.

Headers

x-ms-error-code: string

Security

azure_auth

Azure Active Directory OAuth2 Flow.

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

Name Description
user_impersonation impersonate your user account

Examples

ClassificationRules_CreateOrReplace

Sample Request

PUT {endpoint}/scan/classificationrules/ClassificationRule1?api-version=2023-09-01

{
  "kind": "Custom",
  "properties": {
    "description": "Let's put a cool desc here",
    "classificationName": "MICROSOFT.FINANCIAL.AUSTRALIA.BANK_ACCOUNT_NUMBER",
    "columnPatterns": [
      {
        "pattern": "^data$",
        "kind": "Regex"
      }
    ],
    "dataPatterns": [
      {
        "pattern": "^[0-9]{2}-[0-9]{4}-[0-9]{6}-[0-9]{3}$",
        "kind": "Regex"
      }
    ],
    "minimumPercentageMatch": 60,
    "ruleStatus": "Enabled"
  }
}

Sample Response

x-ms-request-id: d5496da4-9c52-402f-b067-83cc9ddea888
{
  "id": "classificationRules/ClassificationRule1",
  "name": "ClassificationRule1",
  "kind": "Custom",
  "properties": {
    "minimumPercentageMatch": 80,
    "classificationAction": "Keep",
    "description": "second one",
    "version": 4,
    "classificationName": "MICROSOFT.FINANCIAL.AUSTRALIA.BANK_ACCOUNT_NUMBER",
    "ruleStatus": "Enabled",
    "createdAt": "2019-12-09T06:43:30.8478469Z",
    "lastModifiedAt": "2019-12-09T07:04:53.2807344Z",
    "dataPatterns": [
      {
        "kind": "Regex",
        "pattern": "^data1$"
      },
      {
        "kind": "Regex",
        "pattern": "^data2$"
      }
    ],
    "columnPatterns": [
      {
        "kind": "Regex",
        "pattern": "^column1$"
      }
    ]
  }
}
x-ms-request-id: d5496da4-9c52-402f-b067-83cc9ddea888
{
  "id": "/subscriptions/433a8dfd-e5d5-4e77-ad86-90acdc75eb1a/resourceGroups/SampleResourceGroup/providers/Microsoft.DataCatalog/DataCatalogs/Catalog1/ClassificationRules/ClassificationRule1",
  "name": "ClassificationRule1",
  "kind": "Custom",
  "properties": {
    "minimumPercentageMatch": 80,
    "classificationAction": "Keep",
    "description": "second one",
    "version": 4,
    "classificationName": "MICROSOFT.FINANCIAL.AUSTRALIA.BANK_ACCOUNT_NUMBER",
    "ruleStatus": "Enabled",
    "createdAt": "2019-12-09T06:43:30.8478469Z",
    "lastModifiedAt": "2019-12-09T07:04:53.2807344Z",
    "dataPatterns": [
      {
        "kind": "Regex",
        "pattern": "^data1$"
      },
      {
        "kind": "Regex",
        "pattern": "^data2$"
      }
    ],
    "columnPatterns": [
      {
        "kind": "Regex",
        "pattern": "^column1$"
      }
    ]
  }
}

Definitions

Name Description
ClassificationAction

The action of classification rule.

ClassificationRuleStatus

The rule status of system classification rule.

CustomClassificationRule

Rule of custom classification.

CustomClassificationRuleProperties

The properties of custom classification rule.

ErrorModel

The error model.

ErrorResponseModel

The error response model.

RegexClassificationRulePattern

Pattern of regex classification rule.

SystemClassificationRule

The rule of system classification.

SystemClassificationRuleProperties

The properties of system classification rule.

ClassificationAction

The action of classification rule.

Name Type Description
Delete

string

Keep

string

ClassificationRuleStatus

The rule status of system classification rule.

Name Type Description
Disabled

string

Enabled

string

CustomClassificationRule

Rule of custom classification.

Name Type Description
id

string

The resource identifier.

kind string:

Custom

The kind of classification rule.

name

string

The resource name.

properties

CustomClassificationRuleProperties

The properties of custom classification rule.

CustomClassificationRuleProperties

The properties of custom classification rule.

Name Type Description
classificationAction

ClassificationAction

The action of classification rule.

classificationName

string

The classification name of custom classification rule.

columnPatterns ClassificationRulePattern[]:

RegexClassificationRulePattern[]

The column patterns of custom classification rule.

createdAt

string

The create time of custom classification rule.

dataPatterns ClassificationRulePattern[]:

RegexClassificationRulePattern[]

The data patterns of custom classification rule.

description

string

The description of custom classification rule.

lastModifiedAt

string

The last modified time of custom classification rule.

minimumPercentageMatch

number

ruleStatus

ClassificationRuleStatus

The rule status of custom classification rule.

version

integer

The version of custom classification rule.

ErrorModel

The error model.

Name Type Description
code

string

A unique error code that identifies the specific error.

details

ErrorModel[]

An array of nested ErrorModel objects that provides additional error details.

message

string

A human-readable error message that provides more details about the error.

target

string

The specific component that the error is associated with.

ErrorResponseModel

The error response model.

Name Type Description
error

ErrorModel

The error model.

RegexClassificationRulePattern

Pattern of regex classification rule.

Name Type Description
kind string:

Regex

The properties of classification rule pattern.

pattern

string

The pattern of regex classification rule pattern.

SystemClassificationRule

The rule of system classification.

Name Type Description
id

string

The resource identifier.

kind string:

System

The kind of classification rule.

name

string

The resource name.

properties

SystemClassificationRuleProperties

The properties of system classification rule.

SystemClassificationRuleProperties

The properties of system classification rule.

Name Type Description
classificationName

string

The classification name of system classification rule.

createdAt

string

The create time of system classification rule.

description

string

lastModifiedAt

string

The last modified time of system classification rule.

ruleStatus

ClassificationRuleStatus

The rule status of system classification rule.

version

integer

The version of system classification rule.