New-AzureRmAlertRuleEmail

Creates an email action for an alert rule.

Warning

The AzureRM PowerShell module has been officially deprecated as of February 29, 2024. Users are advised to migrate from AzureRM to the Az PowerShell module to ensure continued support and updates.

Although the AzureRM module may still function, it's no longer maintained or supported, placing any continued use at the user's discretion and risk. Please refer to our migration resources for guidance on transitioning to the Az module.

Syntax

New-AzureRmAlertRuleEmail
   [[-CustomEmail] <String[]>]
   [-SendToServiceOwner]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]

Description

The New-AzureRmAlertRuleEmail cmdlet creates an e-mail action for an alert rule.

Examples

Example 1: Create an alert rule email action for service owners

PS C:\>New-AzureRmAlertRuleEmail -SendToServiceOwners

This command creates an alert rule email action to send for its service owners when an alert rule is fired.

Example 2: Create an alert rule email action for non-service owners

PS C:\>New-AzureRmAlertRuleEmail -CustomEmails pattif@contoso.com,davidchew@contoso.net

This command creates an alert rule email action for the specified email addresses, but not for the service owners.

Example 3: Create an alert rule email action for service owners and non-service owners

PS C:\>New-AzureRmAlertRuleEmail -CustomEmails pattif@contoso.net -SendToServiceOwners

This command creates an alert rule email action for the specified address and for its service owners.

Parameters

-CustomEmail

Specifies a list of comma-separated e-mail addresses.

Type:String[]
Position:0
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with azure

Type:IAzureContextContainer
Aliases:AzureRmContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-SendToServiceOwner

Indicates that this operation sends an e-mail to the service owners when the rule fires.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

Inputs

String[]

SwitchParameter

Outputs

RuleEmailAction