Set-SqlSensitivityClassification

设置数据库中列的信息类型和/或敏感度标签和信息类型。

语法

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>]

说明

Set-SqlSensitivityClassification cmdlet 设置数据库中列的信息类型和/或敏感度标签。

还可以使用 SQL Server Management Studio(SSMS) 版本 17.5 及更高版本设置信息类型和列的信息类型和信息类型。

可以使用 SQL Server Management Studio(SSMS) 版本 17.5 及更高版本、 扩展属性目录视图Get-SqlSensitivityClassification cmdlet 查看列的信息类型和敏感度标签和信息类型。

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

示例

示例 1:使用 Windows 身份验证在单个列上设置信息类型和敏感度标签

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

将列 Sales.Customers.first_name 的信息类型和敏感度标签分别设置为 NameConfidential - GDPR 分别设置。 信息类型和敏感度标签的值仅限于下面提供的默认值,可以使用 Tab 键获取。

示例 2:使用 Windows 身份验证设置单个列的信息类型

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

将列 Sales.Customers.first_name 的信息类型设置为 Personal。 如果以前设置过敏感度标签,则敏感度标签将取消设置。

示例 3:使用连接参数设置单个列的敏感度标签

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

将列 Sales.Customers.ip_address 的敏感度标签设置为 Confidential 使用 SQL Server 登录名。 此列的信息类型保持不变。 此命令会提示输入密码以完成身份验证。

示例 4:使用当前路径上下文设置多个列的信息类型和分类标签

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

设置列 Sales.Customers.first_name 的信息类型和敏感度标签,并将 Sales.Customers.last_name 列名数组作为参数提供给 cmdlet。 所有列都将接收相同的信息类型和敏感度标签。 数据库连接信息取自由创建的 Set-Location上下文。

参数

-ColumnName

为其设置了信息类型和敏感度标签的列的名称(s)。

参数属性

类型:

String[]

默认值:None
支持通配符:False
不显示:False
别名:

参数集

(All)
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):True
来自剩余参数的值:False

-ConnectionString

指定要连接到数据库的连接字符串。 如果存在此参数,将忽略其他连接参数

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

ByConnectionString
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-Credential

指定用于连接到数据库的凭据。

参数属性

类型:PSCredential
默认值:None
支持通配符:False
不显示:False

参数集

ByConnectionParameters
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-DatabaseName

指定数据库的名称。 此 cmdlet 连接到 ServerInstance 参数中指定的实例中的此数据库。

如果未指定 DatabaseName 参数,则使用的数据库取决于当前路径是否同时指定 SQLSERVER:\SQL 文件夹和数据库名称。 如果路径同时指定 SQL 文件夹和数据库名称,则此 cmdlet 将连接到路径中指定的数据库。

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

ByConnectionParameters
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-InformationType

描述存储在列中的信息类型的名称。 必须为 SensitivityLabel、InformationType 或两者提供值。 可能的值是有限的,不能扩展。

参数属性

类型:String
默认值:None
接受的值:Networking, Contact Info, Credentials, Credit Card, Banking, Financial, Other, Name, National ID, SSN, Health, Date Of Birth
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):True
来自剩余参数的值:False

-InputObject

指定一个 SQL Server 管理对象(SMO),该对象表示此 cmdlet 使用的数据库。

参数属性

类型:Database
默认值:None
支持通配符:False
不显示:False

参数集

ByDBObject
Position:Named
必需:True
来自管道的值:True
来自管道的值(按属性名称):False
来自剩余参数的值:False

-Path

指定运行该作的 SQL Server 实例的路径。 如果未为此参数指定值,cmdlet 将使用当前工作位置。

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

ByPath
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-SensitivityLabel

描述存储在列中的数据的敏感度的名称。 必须为 SensitivityLabel、InformationType 或两者提供值。 可能的值是有限的,不能扩展。

参数属性

类型:String
默认值:None
接受的值:Public, General, Confidential, Confidential - GDPR, Highly Confidential, Highly Confidential - GDPR
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):True
来自剩余参数的值:False

-SensitivityRank

基于定义敏感度排名的预定义值集的标识符。 其他服务可以使用高级威胁防护等服务根据其排名来检测异常

参数属性

类型:SensitivityRank
默认值:None
接受的值:None, Low, Medium, High, Critical
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):True
来自剩余参数的值:False

-ServerInstance

指定服务器实例(字符串)或 SQL Server 管理对象(SMO)对象的名称,该对象指定数据库引擎实例的名称。 对于默认实例,仅指定计算机名称:MyComputer。 对于命名实例,请使用 ComputerName\InstanceName 格式。

参数属性

类型:PSObject
默认值:None
支持通配符:False
不显示:False

参数集

ByConnectionParameters
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-SuppressProviderContextWarning

指示此 cmdlet 禁止显示此 cmdlet 在当前 SQLSERVER:\SQL 路径设置中使用的数据库上下文中用于为 cmdlet 建立数据库上下文的警告。

参数属性

类型:SwitchParameter
默认值:None
支持通配符:False
不显示:False

参数集

ByContext
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

CommonParameters

此 cmdlet 支持通用参数:-Debug、-ErrorAction、-ErrorVariable、-InformationAction、-InformationVariable、-OutBuffer、-OutVariable、-PipelineVariable、-ProgressAction、-Verbose、-WarningAction 和 -WarningVariable。 有关详细信息,请参阅 about_CommonParameters

输入

System.String

Microsoft.SqlServer.Management.Smo.Database

System.String

输出

System.Object