Get-SqlSensitivityRecommendations
Get recommended sensitivity labels and information types for columns in the database.
Syntax
Get-SqlSensitivityRecommendations
[-SuppressProviderContextWarning]
[-ProgressAction <ActionPreference>]
[<CommonParameters>]
Get-SqlSensitivityRecommendations
-ConnectionString <String>
[-ProgressAction <ActionPreference>]
[<CommonParameters>]
Get-SqlSensitivityRecommendations
-ServerInstance <PSObject>
-DatabaseName <String>
[-Credential <PSCredential>]
[-ProgressAction <ActionPreference>]
[<CommonParameters>]
Get-SqlSensitivityRecommendations
-Path <String>
[-ProgressAction <ActionPreference>]
[<CommonParameters>]
Get-SqlSensitivityRecommendations
-InputObject <Database>
[-ProgressAction <ActionPreference>]
[<CommonParameters>]
Description
The Get-SqlSensitivityRecommendations gets the recommended sensitivity labels and information types for columns in the database. The cmdlet does not return values for columns that already have sensitivity label or information type defined.
The sensitivity labels and information types 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.
The sensitivity labels and information types of columns can be set using SQL Server Management Studio (SSMS) release 17.5 and above, or with the Set-SqlSensitivityClassification cmdlet.
Module requirements: version 21+ on PowerShell 5.1; version 22+ on PowerShell 7.x.
Examples
Example 1: Get information type and sensitivity label recommendations for database using Windows authentication
PS C:\> Get-SqlSensitivityRecommendations -ServerInstance "MyComputer\MainInstance" -Database "myDatabase"
Column InformationType SensitivityLabel SensitivityRank
------ --------------- ---------------- ---------------
Sales.Customers.email Contact Info Confidential Medium
Sales.Customers.first_name Name Confidential - GDPR Medium
Sales.Customers.ip_address Networking Confidential Medium
Sales.Customers.last_name Name Confidential - GDPR Medium
Sales.Orders.AccountNumber Financial Confidential Medium
Sales.Orders.CreditCardApprovalCode Credit Card Confidential Medium
Sales.Orders.CreditCardID Credit Card Confidential Medium
Sales.Orders.CurrencyRateID Financial Confidential Medium
Get the recommended information type and sensitivity label for columns in myDatabase
. The cmdlet will return columns for which the classification algorithm was able to match the column to an information type. Columns that already have an information type or a sensitivity label are not returned by this cmdlet.
Parameters
-ConnectionString
Specifies a connection string to connect to the database. If this parameter is present, other connection parameters will be ignored
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Credential
Specifies a credential used to connect to the database.
Type: | PSCredential |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | 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.
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-InputObject
Specifies a SQL Server Management Object (SMO) that represent the database that this cmdlet uses.
Type: | Database |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | 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.
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-ProgressAction
Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.
Type: | ActionPreference |
Aliases: | proga |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-ServerInstance
Specifieseither 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.
Type: | PSObject |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | 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.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Inputs
Microsoft.SqlServer.Management.Smo.Database
Outputs
System.Object