New-ProtectionAlert

This cmdlet is available only in Security & Compliance PowerShell. For more information, see Security & Compliance PowerShell.

Use the New-ProtectionAlert cmdlet to create alert policies in the Microsoft Purview compliance portal. Alert policies contain conditions that define the user activities to monitor, and the notification options for email alerts and entries in the Microsoft Purview compliance portal.

For information about the parameter sets in the Syntax section below, see Exchange cmdlet syntax.

Syntax

New-ProtectionAlert
   -Category <AlertRuleCategory>
   -Name <String>
   -NotifyUser <MultiValuedProperty>
   -ThreatType <ThreatAlertType>
   [-AggregationType <AlertAggregationType>]
   [-AlertBy <MultiValuedProperty>]
   [-AlertFor <MultiValuedProperty>]
   [-Comment <String>]
   [-Confirm]
   [-CorrelationPolicyId <System.Guid>]
   [-Description <String>]
   [-Disabled <Boolean>]
   [-Filter <String>]
   [-LogicalOperationName <String>]
   [-NotificationCulture <CultureInfo>]
   [-NotificationEnabled <Boolean>]
   [-NotifyUserOnFilterMatch <Boolean>]
   [-NotifyUserSuppressionExpiryDate <DateTime>]
   [-NotifyUserThrottleThreshold <Int32>]
   [-NotifyUserThrottleWindow <Int32>]
   [-Operation <MultiValuedProperty>]
   [-PrivacyManagementScopedSensitiveInformationTypes <MultiValuedProperty>]
   [-PrivacyManagementScopedSensitiveInformationTypesForCounting <MultiValuedProperty>]
   [-PrivacyManagementScopedSensitiveInformationTypesThreshold <System.UInt64>]
   [-CustomProperties <PswsHashtable>]
   [-Severity <RuleSeverity>]
   [-Threshold <Int32>]
   [-TimeWindow <Int32>]
   [-UseCreatedDateTime <System.Boolean>]
   [-VolumeThreshold <System.UInt64>]
   [-WhatIf]
   [<CommonParameters>]

Description

To use this cmdlet in Security & Compliance PowerShell, you need to be assigned permissions. For more information, see Permissions in the Microsoft Purview compliance portal.

Examples

Example 1

New-ProtectionAlert -Name "Content search deleted" -Category Others -NotifyUser admin@contoso.com -ThreatType Activity -Operation SearchRemoved -Description "Custom alert policy to track when content searches are deleted" -AggregationType None

This example creates an alert policy that triggers an alert whenever anyone in the organization deletes a Content Search in the Microsoft Purview compliance portal.

Parameters

-AggregationType

The AggregationType parameter specifies the how the alert policy triggers alerts for multiple occurrences of monitored activity. Valid values are:

  • None: Alerts are triggered for every occurrence of the activity.
  • SimpleAggregation: Alerts are triggered based on the volume of activity in a given time window (the values of the Threshold and TimeWindow parameters). This is the default value.
  • AnomalousAggregation: Alerts are triggered when the volume of activity reaches unusual levels (greatly exceeds the normal baseline that's established for the activity). Note that it can take up to 7 days for Microsoft 365 to establish the baseline. During the baseline calculation period, no alerts are generated for the activity.
Type:AlertAggregationType
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Security & Compliance

-AlertBy

The AlertBy parameter specifies the scope for aggregated alert policies. Valid values are determined by the ThreatType parameter value:

  • Activity: Valid values are User or $null (blank, which is the default value). If you don't use the value User, the scope of the alert policy is the entire organization.
  • Malware: Valid values are Mail.Recipient or Mail.ThreatName.

You can't use this parameter when the AggregationType parameter value is None (alerts are triggered for every occurrence of the activity).

Type:MultiValuedProperty
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Security & Compliance

-AlertFor

This parameter is reserved for internal Microsoft use.

Type:MultiValuedProperty
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Security & Compliance

-Category

The Category parameter specifies a category for the alert policy. Valid values are:

  • AccessGovernance
  • ComplianceManager
  • DataGovernance
  • MailFlow
  • Others
  • PrivacyManagement
  • Supervision
  • ThreatManagement

When an activity occurs that matches the conditions of the alert policy, the alert that's generated is tagged with the category that's specified by this parameter. This allows you to track and manage alerts that have the same category setting

Type:AlertRuleCategory
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Security & Compliance

-Comment

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".

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Security & Compliance

-Confirm

The Confirm switch specifies whether to show or hide the confirmation prompt. How this switch affects the cmdlet depends on if the cmdlet requires confirmation before proceeding.

  • Destructive cmdlets (for example, Remove-* cmdlets) have a built-in pause that forces you to acknowledge the command before proceeding. For these cmdlets, you can skip the confirmation prompt by using this exact syntax: -Confirm:$false.
  • Most other cmdlets (for example, New-* and Set-* cmdlets) don't have a built-in pause. For these cmdlets, specifying the Confirm switch without a value introduces a pause that forces you acknowledge the command before proceeding.
Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Security & Compliance

-CorrelationPolicyId

{{ Fill CorrelationPolicyId Description }}

Type:System.Guid
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Security & Compliance

-CustomProperties

{{ Fill CustomProperties Description }}

Type:PswsHashtable
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Security & Compliance

-Description

The Description parameter specifies descriptive text for the alert policy. If the value contains spaces, enclose the value in quotation marks (").

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Security & Compliance

-Disabled

The Disabled parameter enables or disables the alert policy. Valid values are:

  • $true: The alert policy is disabled.
  • $false: The alert policy is enabled. This is the default value.
Type:Boolean
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Security & Compliance

-Filter

The Filter parameter uses OPATH syntax to filter the results by the specified properties and values. The search criteria uses the syntax "Property -ComparisonOperator 'Value'".

  • Enclose the whole OPATH filter in double quotation marks " ". If the filter contains system values (for example, $true, $false, or $null), use single quotation marks ' ' instead. Although this parameter is a string (not a system block), you can also use braces { }, but only if the filter doesn't contain variables.
  • Property is a filterable property.
  • ComparisonOperator is an OPATH comparison operator (for example -eq for equals and -like for string comparison). For more information about comparison operators, see about_Comparison_Operators.
  • Value is the property value to search for. Enclose text values and variables in single quotation marks ('Value' or '$Variable'). If a variable value contains single quotation marks, you need to identify (escape) the single quotation marks to expand the variable correctly. For example, instead of '$User', use '$($User -Replace "'","''")'. Don't enclose integers or system values in quotation marks (for example, use 500, $true, $false, or $null instead).

You can chain multiple search criteria together using the logical -and operator (for example, "Criteria1 -and Criteria2").

For detailed information about OPATH filters in Exchange, see Additional OPATH syntax information.

The filterable properties are:

Activity

  • Activity.ClientIp
  • Activity.CreationTime
  • Activity.Item
  • Activity.ItemType
  • Activity.Operation
  • Activity.ResultStatus
  • Activity.Scope
  • Activity.SiteUrl
  • Activity.SourceFileExtension
  • Activity.SourceFileName
  • Activity.TargetUserOrGroupType
  • Activity.UserAgent
  • Activity.UserId
  • Activity.UserType
  • Activity.Workload

Malware

  • Mail:AttachmentExtensions
  • Mail:AttachmentNames
  • Mail:CreationTime
  • Mail:DeliveryStatus
  • Mail:Direction
  • Mail:From
  • Mail:FromDomain
  • Mail:InternetMessageId
  • Mail:IsIntraOrgSpoof
  • Mail:IsMalware
  • Mail:IsSpam
  • Mail:IsThreat
  • Mail:Language
  • Mail:Recipient
  • Mail:Scl
  • Mail:SenderCountry
  • Mail:SenderIpAddress
  • Mail:Subject
  • Mail:TenantId
  • Mail:ThreatName
Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Security & Compliance

-LogicalOperationName

{{ Fill LogicalOperationName Description }}

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Security & Compliance

-Name

The Name parameter specifies the unique name for the alert policy. If the value contains spaces, enclose the value in quotation marks (").

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Security & Compliance

-NotificationCulture

The NotificationCulture parameter specifies the language or locale that's used for notifications.

Valid input for this parameter is a supported culture code value from the Microsoft .NET Framework CultureInfo class. For example, da-DK for Danish or ja-JP for Japanese. For more information, see CultureInfo Class.

Type:CultureInfo
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Security & Compliance

-NotificationEnabled

{{ Fill NotificationEnabled Description }}

Type:Boolean
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Security & Compliance

-NotifyUser

The NotifyUser parameter specifies the SMTP address of the user who receives notification messages for the alert policy. You can specify multiple values separated by commas.

Type:MultiValuedProperty
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Security & Compliance

-NotifyUserOnFilterMatch

The NotifyUserOnFilterMatch parameter specifies whether to trigger an alert for a single event when the alert policy is configured for aggregated activity. Valid values are:

  • $true: Even though the alert is configured for aggregated activity, a notification is triggered during a match for the activity (basically, an early warning).
  • $false: Alerts are triggered according to the specified aggregation type. This is the default value.

You can't use this parameter when the AggregationType parameter value is None (alerts are triggered for every occurrence of the activity).

Type:Boolean
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Security & Compliance

-NotifyUserSuppressionExpiryDate

The NotifyUserSuppressionExpiryDate parameter specifies whether to temporarily suspend notifications for the alert policy. Until the specified date-time, no notifications are sent for detected activities.

Use the short date format that's defined in the Regional Options settings on the computer where you're running the command. For example, if the computer is configured to use the short date format MM/dd/yyyy, enter 09/01/2018 to specify September 1, 2018. You can enter the date only, or you can enter the date and time of day. If you enter the date and time of day, enclose the value in quotation marks ("), for example, "09/01/2018 5:00 PM".

Type:DateTime
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Security & Compliance

-NotifyUserThrottleThreshold

The NotifyUserThrottleThreshold parameter specifies the maximum number of notifications for the alert policy within the time period specified by the NotifyUserThrottleWindow parameter. Once the maximum number of notifications has been reached in the time period, no more notifications are sent for the alert. Valid values are:

  • An integer.
  • The value $null. This is the default value (no maximum number of notifications for an alert).
Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Security & Compliance

-NotifyUserThrottleWindow

The NotifyUserThrottleWindow parameter specifies the time interval in minutes that's used by the NotifyUserThrottleThreshold parameter. Valid values are:

  • An integer.
  • The value $null. This is the default value (no interval for notification throttling).
Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Security & Compliance

-Operation

The Operation parameter specifies the activities that are monitored by the alert policy. For the list of available activities, see the Audited activities tab at Audited activities.

Although this parameter is technically capable of accepting multiple values separated by commas, multiple values don't work.

You can only use this parameter when the ThreatType parameter has the value Activity.

Type:MultiValuedProperty
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Security & Compliance

-PrivacyManagementScopedSensitiveInformationTypes

{{ Fill PrivacyManagementScopedSensitiveInformationTypes Description }}

Type:MultiValuedProperty
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Security & Compliance

-PrivacyManagementScopedSensitiveInformationTypesForCounting

{{ Fill PrivacyManagementScopedSensitiveInformationTypesForCounting Description }}

Type:MultiValuedProperty
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Security & Compliance

-PrivacyManagementScopedSensitiveInformationTypesThreshold

{{ Fill PrivacyManagementScopedSensitiveInformationTypesThreshold Description }}

Type:System.UInt64
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Security & Compliance

-Severity

The Severity parameter specifies the severity of the detection. Valid values are:

  • Low (This is the default value)
  • Medium
  • High
Type:RuleSeverity
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Security & Compliance

-ThreatType

The ThreatType parameter specifies the type of activities that are monitored by the alert policy. Valid values are:

  • Activity
  • Malware

The value that you select for this parameter determines the values you can use for the AlertBy, Filter, and Operation parameters.

You can't change this value after you create the alert policy.

Type:ThreatAlertType
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Security & Compliance

-Threshold

The Threshold parameter specifies the number of detections that trigger the alert policy within the time period specified by the TimeWindow parameter. A valid value is an integer that's greater than or equal to 3.

You can only use this parameter when the AggregationType parameter value is SimpleAggregation.

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Security & Compliance

-TimeWindow

The TimeWindow parameter specifies the time interval in minutes for number of detections specified by the Threshold parameter. A valid value is an integer that's greater than 60 (one hour).

You can only use this parameter when the AggregationType parameter value is SimpleAggregation.

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Security & Compliance

-UseCreatedDateTime

{{ Fill UseCreatedDateTime Description }}

Type:System.Boolean
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Security & Compliance

-VolumeThreshold

{{ Fill VolumeThreshold Description }}

Type:System.UInt64
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Security & Compliance

-WhatIf

The WhatIf switch doesn't work in Security & Compliance PowerShell.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Security & Compliance