Add-AzureRmLogAlertRule

Adds or replaces a log alert rule.

Syntax

Add-AzureRmLogAlertRule
   [-TargetResourceGroup <String>]
   [-TargetResourceId <String>]
   [-Level <String>]
   -OperationName <String>
   [-TargetResourceProvider <String>]
   [-Status <String>]
   [-SubStatus <String>]
   -Location <String>
   [-Description <String>]
   [-DisableRule]
   -ResourceGroup <String>
   -Name <String>
   [-Actions <System.Collections.Generic.List`1[Microsoft.Azure.Management.Monitor.Management.Models.RuleAction]>]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]

Description

The Add-AzureRmLogAlertRule cmdlet adds or replaces an event alert rule. The added rule is associated with a resource group and has a name.

As announced in previous releases: Add-AzureRMLogAlertRule cmdlet will be deprecated in a future release. After October 1st 2017 using this cmdlet will no longer have any effect as this functionality is being transitioned to Activity Log Alerts. Please see https://aka.ms/migratemealerts for more information.

Examples

Example 1: Add a log alert rule

PS C:\>Add-AzureRmLogAlertRule -Name "logRule" -Location "East US" -ResourceGroup "Default-Web-EastUS" -OperationName "Create" -TargetResourceId "/subscriptions/abbfb07c-6c93-40be-bc9b-4f0deba32f4c/resourceGroups/Default-Web-EastUS/providers/microsoft.web/sites/misitiooeltuyo" -Description "My log rule"
RequestId                                                                                                    StatusCode
---------                                                                                                    ----------
9a5bc388-c7ac-4dc6-aa70-f4bc29c2c712                                                                                 OK

This command adds or updates an event-based alert rule.

Required Parameters

-Location

Specifies the location for the rule.

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-Name

Specifies the name of the rule.

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-OperationName

Specifies the name of the operation.

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-ResourceGroup

Specifies the name of the resource group for the rule.

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False

Optional Parameters

-Actions

Specifies a comma-separated list of actions.

Type:System.Collections.Generic.List`1[Microsoft.Azure.Management.Monitor.Management.Models.RuleAction]
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-DefaultProfile

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

Type:Microsoft.Azure.Commands.Common.Authentication.Abstractions.IAzureContextContainer
Aliases:AzureRmContext, AzureCredential
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Description

Specifies a description of the rule.

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-DisableRule

Disables a rule. If you do not specify this parameter, the rule is enabled.

Type:System.Management.Automation.SwitchParameter
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-Level

Specifies the level of the event the rule is monitoring. Specify this parameter only for event-based rules.

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-Status

Specifies the status.

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-SubStatus

Specifies the substatus.

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-TargetResourceGroup

Specifies the resource group of the resource the rule is monitoring.

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-TargetResourceId

Specifies the ID of the resource the rule is monitoring.

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-TargetResourceProvider

Specifies the resource provider of the resource the rule is monitoring.

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False

Outputs

Microsoft.Azure.Commands.Insights.OutputClasses.PSAddAlertRuleOperationResponse