Author | Sander Stad (@sqlstad, sqlstad.nl) |
Availability | Windows, Linux, macOS |
Want to see the source code for this command? Check out Invoke-DbaDbPiiScan on GitHub.
Want to see the Bill Of Health for this command? Check out Invoke-DbaDbPiiScan.
Command to return any columns that could potentially contain PII (Personal Identifiable Information)
This command will go through the tables in your database and assess each column.
It will first check the columns names if it was named in such a way that it would indicate PII.
The next thing that it will do is pattern recognition by looking into the data from the table.
Custom scan definitions can be specified using the formats seen in
Invoke-DbaDbPiiScan
[[-SqlInstance] <DbaInstanceParameter[]>]
[[-SqlCredential] <PSCredential>]
[[-Database] <String[]>]
[[-Table] <String[]>]
[[-Column] <String[]>]
[[-Country] <String[]>]
[[-CountryCode] <String[]>]
[[-ExcludeTable] <String[]>]
[[-ExcludeColumn] <String[]>]
[[-SampleCount] <Int32>]
[[-KnownNameFilePath] <String>]
[[-PatternFilePath] <String>]
[-ExcludeDefaultKnownName]
[-ExcludeDefaultPattern]
[-EnableException]
[<CommonParameters>]
PS C:\> Invoke-DbaDbPiiScan -SqlInstance sql1 -Database db1
Scan the database db1 on instance sql1
PS C:\> Invoke-DbaDbPiiScan -SqlInstance sql1, sql2 -Database db1, db2
Scan multiple databases on multiple instances
PS C:\> Invoke-DbaDbPiiScan -SqlInstance sql1 -Database db2 -ExcludeColumn firstname
Scan database db2 but exclude the column firstname
PS C:\> Invoke-DbaDbPiiScan -SqlInstance sql1 -Database db2 -CountryCode US
Scan database db2 but only apply data patterns used for the United States
PS C:\> Invoke-DbaDbPiiScan -SqlInstance sql1 -Database db1 -PatternFilePath c:\pii\patterns.json
Scans db1 on instance sql1 with additional custom patterns
PS C:\> Invoke-DbaDbPiiScan -SqlInstance sql1 -Database db1 -PatternFilePath c:\pii\patterns.json -ExcludeDefaultPattern
Scans db1 on instance sql1 with additional custom patterns, excluding the default patterns
The target SQL Server instance or instances.
Alias | |
Required | False |
Pipeline | false |
Default Value |
Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).
Windows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.
For MFA support, please use Connect-DbaInstance.
Alias | |
Required | False |
Pipeline | false |
Default Value |
Databases to process through
Alias | |
Required | False |
Pipeline | false |
Default Value |
Table(s) to process. By default all the tables will be processed
Alias | |
Required | False |
Pipeline | false |
Default Value |
Column(s) to process. By default all the columns will be processed
Alias | |
Required | False |
Pipeline | false |
Default Value |
Filter out the patterns and known types for one or more countries
Alias | |
Required | False |
Pipeline | false |
Default Value |
Filter out the patterns and known types for one or more country code
Alias | |
Required | False |
Pipeline | false |
Default Value |
Exclude certain tables
Alias | |
Required | False |
Pipeline | false |
Default Value |
Exclude certain columns
Alias | |
Required | False |
Pipeline | false |
Default Value |
Amount of rows to sample to make an assessment. The default is 100
Alias | |
Required | False |
Pipeline | false |
Default Value | 100 |
Points to a file containing the custom known names. Custom scan definitions can be specified using the format seen in
Alias | |
Required | False |
Pipeline | false |
Default Value |
Points to a file containing the custom patterns. Custom scan definitions can be specified using the format seen in
Alias | |
Required | False |
Pipeline | false |
Default Value |
Excludes the default known names
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
Excludes the default patterns
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.
This avoids overwhelming you with "sea of red" exceptions, but is inconvenient because it basically disables advanced scripting.
Using this switch turns this "nice by default" feature off and enables you to catch exceptions with your own try/catch.
Alias | |
Required | False |
Pipeline | false |
Default Value | False |