Commands › Exchange Online

New-SensitiveInformationScanRule

Exchange Online ExchangeOnlineManagement New-*

For more information, see Security & Compliance PowerShell. Use the New-SensitiveInformationScan cmdlet to create sensitive information scan rules.

Quick start script

# New-SensitiveInformationScanRule — quick start (serv365.ai)
# 1. Connect (app-only shown; interactive: omit the certificate parameters)
Connect-ExchangeOnline -CertificateThumbprint $thumb -AppId $appId -Organization $org

# 2. Capture the current state first — you cannot roll back what you never recorded
$before = Get-SensitiveInformationScanRule
$before | Format-List

# 3. Make the change (dry run first)
New-SensitiveInformationScanRule -Name <String> -Policy <PolicyIdParameter> -Workload <Workload> -WhatIf
New-SensitiveInformationScanRule -Name <String> -Policy <PolicyIdParameter> -Workload <Workload>

# 4. Verify and diff
$after = Get-SensitiveInformationScanRule
Compare-Object ($before | Out-String) ($after | Out-String)

Syntax

New-SensitiveInformationScanRule [-Name] <String> -Policy <PolicyIdParameter> -Workload <PolicyConfiguration.Workload>
 [-Comment <String>]
 [-Confirm]
 [-ContentCreatedOrUpdatedDateFrom <System.DateTime>]
 [-ContentCreatedOrUpdatedDateTo <System.DateTime>]
 [-ContentExtensionMatchesWords <MultiValuedProperty>]
 [-ContentPropertyContainsWords <MultiValuedProperty>]
 [-ExceptIfContentExtensionMatchesWords <MultiValuedProperty>]
 [-ExceptIfContentPropertyContainsWords <MultiValuedProperty>]
 [-StartImpactAssessment <Boolean>]
 [-WhatIf]
 [<CommonParameters>]

Parameters (13)

ParameterTypeRequiredWhat it controls
-Name String yes The Name parameter specifes the unique rule name for the scan. If the value contains spaces, enclose the value in quotation marks.
-Policy PolicyIdParameter yes The Policy parameter specifies the name of the parent scan policy for this rule. If the value contains spaces, enclose the value in quotation marks.
-Workload Workload yes The Workload parameter specifies the workload. Valid values are:
-Comment String The Comment parameter specifies an optional comment. If you specify a value that contains spaces, enclose the value in quotation marks ("), for example: "This is an admin note".
-Confirm SwitchParameter The Confirm switch specifies whether to show or hide the confirmation prompt. How this switch affects the cmdlet depends on whether the cmdlet requires confirmation before proceeding.
-ContentCreatedOrUpdatedDateFrom DateTime The ContentCreatedOrUpdatedDateFrom parameter specifies the earliest modification date-time of files that are considered in scope of this scan.
-ContentCreatedOrUpdatedDateTo DateTime The ContentCreatedOrUpdatedDateTo parameter specifies the latest modification date-time of files that are considered in scope of this scan.
-ContentExtensionMatchesWords MultiValuedProperty The ContentExtensionMatchesWords parameter specifies a condition for the rule that looks for words in file extensions. You can specify multiple words separated by commas. Irrespective of the original file type, this...
-ContentPropertyContainsWords MultiValuedProperty The ContentPropertyContainsWords parameter specifies a condition for the rule that's based on a property match in content. The rule is applied to content that contains the specified property.
-ExceptIfContentExtensionMatchesWords MultiValuedProperty The ExceptIfContentExtensionMatchesWords parameter specifies an exception for the rule that looks for words in file extensions. You can specify multiple words separated by commas. Irrespective of what the original...
-ExceptIfContentPropertyContainsWords MultiValuedProperty The ExceptIfContentPropertyContainsWords parameter specifies an exception for the rule that's based on a property match in content. The rule is not applied to content that contains the specified property.
-StartImpactAssessment Boolean The StartImpactAssessment parameter specifies whether to start a scan estimation. Valid values are:
-WhatIf SwitchParameter The WhatIf switch doesn't work in Security & Compliance PowerShell.

Reference facts derived from Microsoft documentation, © Microsoft, licensed CC BY 4.0; restructured with original guidance by serv365.ai.