Поделиться через


Set-SqlSensitivityClassification

Set the information type and/or sensitivity label and information type of columns in the database.

Синтаксис

ByContext (по умолчанию)

Set-SqlSensitivityClassification
    -ColumnName <String[]>
    [-SuppressProviderContextWarning]
    [-SensitivityRank <SensitivityRank>]
    [-InformationType <String>]
    [-SensitivityLabel <String>]
    [<CommonParameters>]

ByConnectionString

Set-SqlSensitivityClassification
    -ColumnName <String[]>
    -ConnectionString <String>
    [-SensitivityRank <SensitivityRank>]
    [-InformationType <String>]
    [-SensitivityLabel <String>]
    [<CommonParameters>]

ByConnectionParameters

Set-SqlSensitivityClassification
    -ColumnName <String[]>
    -ServerInstance <PSObject>
    -DatabaseName <String>
    [-Credential <PSCredential>]
    [-SensitivityRank <SensitivityRank>]
    [-InformationType <String>]
    [-SensitivityLabel <String>]
    [<CommonParameters>]

ByPath

Set-SqlSensitivityClassification
    -ColumnName <String[]>
    -Path <String>
    [-SensitivityRank <SensitivityRank>]
    [-InformationType <String>]
    [-SensitivityLabel <String>]
    [<CommonParameters>]

ByDBObject

Set-SqlSensitivityClassification
    -ColumnName <String[]>
    -InputObject <Database>
    [-SensitivityRank <SensitivityRank>]
    [-InformationType <String>]
    [-SensitivityLabel <String>]
    [<CommonParameters>]

Описание

The Set-SqlSensitivityClassification cmdlet sets the information type and/or Sensitivity label of columns in the database.

The information type and sensitivity label and information type of columns also be set using SQL Server Management Studio (SSMS) release 17.5 and above.

The information type and sensitivity label and information type of columns can be viewed using SQL Server Management Studio (SSMS) release 17.5 and above, the Extended Properties catalog view, or the Get-SqlSensitivityClassification cmdlet.

Module requirements: version 21+ on PowerShell 5.1; version 22+ on PowerShell 7.x.

Примеры

Example 1: Set information type and sensitivity label on a single column using Windows authentication

PS C:\> Set-SqlSensitivityClassification -ServerInstance "MyComputer\MainInstance" -Database "myDatabase" -ColumnName "Sales.Customers.first_name" -InformationType "Name" -SensitivityLabel "Confidential - GDPR" -SensitivityRank "Low"

Column                      InformationType SensitivityLabel    SensitivityRank
------                      --------------- ----------------    ---------------
Sales.Customers.first_name  Name            Confidential - GDPR Low

Set the information type and sensitivity label of column Sales.Customers.first_name to Name and Confidential - GDPR respectively. The values for information type and sensitivity label are limited to the default values provided below, and can be obtained by using the Tab key.

Example 2: Set the information type of a single column using Windows authentication

PS C:\> Set-SqlSensitivityClassification -ServerInstance "MyComputer\MainInstance" -Database "myDatabase" -ColumnName "Sales.Customers.first_name" -InformationType "Personal"

Column                      InformationType SensitivityLabel SensitivityRank
------                      --------------- ---------------- ---------------
Sales.Customers.first_name  Personal

Set the information type of column Sales.Customers.first_name to Personal. The sensitivity label will be unset if it was previously set.

Example 3: Set the sensitivity label of a single column using connection parameters

PS C:\> Set-SqlSensitivityClassification -ServerInstance "MyComputer\MainInstance" -Database "myDatabase" -Credential (Get-Credential "sa") -ColumnName "Sales.Customers.ip_address" -SensitivityLabel "Confidential"

Column                      InformationType SensitivityLabel SensitivityRank
------                      --------------- ---------------- ---------------
Sales.Customers.ip_address                  Confidential

Set the sensitivity label of column Sales.Customers.ip_address to Confidential using the SQL Server login. The information type for this column remains unset. This command prompts you for a password to complete the authentication.

Example 4: Set the information type and classification label of multiple columns using current path context

PS C:\> $columns = @("Sales.Customers.first_name" , "Sales.Customers.last_name")
PS C:\> Set-Location "SQLSERVER:\SQL\MyComputer\MainInstance\Databases\MyDatabase"
PS SQLSERVER:\SQL\MyComputer\MainInstance> Set-SqlSensitivityClassification -ColumnName $columns -InformationType "Name" -SensitivityLabel "Confidential - GDPR" -SensitivityRank "Critical"
 WARNING: Using provider context. Server = MyComputer, Database = MyDatabase.

Column                      InformationType SensitivityLabel    SensitivityRank
------                      --------------- ----------------    ---------------
Sales.Customers.first_name  Name            Confidential - GDPR Critical
Sales.Customers.last_name   Name            Confidential - GDPR Critical

Set the information type and sensitivity label of column Sales.Customers.first_name and Sales.Customers.last_name by providing array of column names as argument to the cmdlet. All columns will receive the same information type and sensitivity label. Database connection information is taken from the context that is created by Set-Location.

Параметры

-ColumnName

Name(s) of columns for which information type and sensitivity label is set.

Свойства параметра

Тип:

String[]

Default value:None
Поддерживаются подстановочные знаки:False
DontShow:False
Aliases:Column

Наборы параметров

(All)
Position:Named
Обязательно:True
Значение из конвейера:False
Значение из конвейера по имени свойства:True
Значение из оставшихся аргументов:False

-ConnectionString

Specifies a connection string to connect to the database. If this parameter is present, other connection parameters will be ignored

Свойства параметра

Тип:String
Default value:None
Поддерживаются подстановочные знаки:False
DontShow:False

Наборы параметров

ByConnectionString
Position:Named
Обязательно:True
Значение из конвейера:False
Значение из конвейера по имени свойства:False
Значение из оставшихся аргументов:False

-Credential

Specifies a credential used to connect to the database.

Свойства параметра

Тип:PSCredential
Default value:None
Поддерживаются подстановочные знаки:False
DontShow:False

Наборы параметров

ByConnectionParameters
Position:Named
Обязательно:False
Значение из конвейера:False
Значение из конвейера по имени свойства:False
Значение из оставшихся аргументов:False

-DatabaseName

Specifies the name of a database. This cmdlet connects to this database in the instance that is specified in the ServerInstance parameter.

If the DatabaseName parameter is not specified, the database that is used depends on whether the current path specifies both the SQLSERVER:\SQL folder and a database name. If the path specifies both the SQL folder and a database name, this cmdlet connects to the database that is specified in the path.

Свойства параметра

Тип:String
Default value:None
Поддерживаются подстановочные знаки:False
DontShow:False

Наборы параметров

ByConnectionParameters
Position:Named
Обязательно:True
Значение из конвейера:False
Значение из конвейера по имени свойства:False
Значение из оставшихся аргументов:False

-InformationType

A name that describes the information type that is stored in the column(s). You must provide a value for SensitivityLabel, InformationType, or both. Possible values are limited and cannot be extended.

Свойства параметра

Тип:String
Default value:None
Допустимые значения:Networking, Contact Info, Credentials, Credit Card, Banking, Financial, Other, Name, National ID, SSN, Health, Date Of Birth
Поддерживаются подстановочные знаки:False
DontShow:False

Наборы параметров

(All)
Position:Named
Обязательно:False
Значение из конвейера:False
Значение из конвейера по имени свойства:True
Значение из оставшихся аргументов:False

-InputObject

Specifies a SQL Server Management Object (SMO) that represent the database that this cmdlet uses.

Свойства параметра

Тип:Database
Default value:None
Поддерживаются подстановочные знаки:False
DontShow:False

Наборы параметров

ByDBObject
Position:Named
Обязательно:True
Значение из конвейера:True
Значение из конвейера по имени свойства:False
Значение из оставшихся аргументов:False

-Path

Specifies the path to the instance of SQL Server on which this cmdlet runs the operation. If you do not specify a value for this parameter, the cmdlet uses the current working location.

Свойства параметра

Тип:String
Default value:None
Поддерживаются подстановочные знаки:False
DontShow:False

Наборы параметров

ByPath
Position:Named
Обязательно:True
Значение из конвейера:False
Значение из конвейера по имени свойства:False
Значение из оставшихся аргументов:False

-SensitivityLabel

A name that describes the sensitivity of the data that is stored in the column(s). You must provide a value for SensitivityLabel, InformationType, or both. Possible values are limited and cannot be extended.

Свойства параметра

Тип:String
Default value:None
Допустимые значения:Public, General, Confidential, Confidential - GDPR, Highly Confidential, Highly Confidential - GDPR
Поддерживаются подстановочные знаки:False
DontShow:False

Наборы параметров

(All)
Position:Named
Обязательно:False
Значение из конвейера:False
Значение из конвейера по имени свойства:True
Значение из оставшихся аргументов:False

-SensitivityRank

An identifier based on a predefinied set of values which define sensitivity rank. May be used by other services like Advanced Threat Protection to detect anomalies based on their rank

Свойства параметра

Тип:SensitivityRank
Default value:None
Допустимые значения:None, Low, Medium, High, Critical
Поддерживаются подстановочные знаки:False
DontShow:False

Наборы параметров

(All)
Position:Named
Обязательно:False
Значение из конвейера:False
Значение из конвейера по имени свойства:True
Значение из оставшихся аргументов:False

-ServerInstance

Specifies either the name of the server instance (a string) or SQL Server Management Objects (SMO) object that specifies the name of an instance of the Database Engine. For default instances, only specify the computer name: MyComputer. For named instances, use the format ComputerName\InstanceName.

Свойства параметра

Тип:PSObject
Default value:None
Поддерживаются подстановочные знаки:False
DontShow:False

Наборы параметров

ByConnectionParameters
Position:Named
Обязательно:True
Значение из конвейера:False
Значение из конвейера по имени свойства:False
Значение из оставшихся аргументов:False

-SuppressProviderContextWarning

Indicates that this cmdlet suppresses the warning that this cmdlet has used in the database context from the current SQLSERVER:\SQL path setting to establish the database context for the cmdlet.

Свойства параметра

Тип:SwitchParameter
Default value:None
Поддерживаются подстановочные знаки:False
DontShow:False

Наборы параметров

ByContext
Position:Named
Обязательно:False
Значение из конвейера:False
Значение из конвейера по имени свойства:False
Значение из оставшихся аргументов:False

CommonParameters

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.

Входные данные

System.String

Microsoft.SqlServer.Management.Smo.Database

System.String

Выходные данные

System.Object