Add-AzWebtestAlertRule

Adds or updates a webtest alert rule.

Syntax

Add-AzWebtestAlertRule
   -MetricName <String>
   -TargetResourceUri <String>
   -WindowSize <TimeSpan>
   -FailedLocationCount <Int32>
   [-MetricNamespace <String>]
   -Location <String>
   [-Description <String>]
   [-DisableRule]
   -ResourceGroupName <String>
   -Name <String>
   [-Action <System.Collections.Generic.List`1[Microsoft.Azure.Management.Monitor.Management.Models.RuleAction]>]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

The Add-AzWebtestAlertRule cmdlet adds or updates an alert rule of either metric, event, or webtest type. The added rule is associated to a resource group and has a name. This cmdlet implements the ShouldProcess pattern, i.e. it might request confirmation from the user before actually creating, modifying, or removing the resource.

Examples

Example 1: Add a webtest alert rule

Add-AzWebtestAlertRule -Name "webtestRule" -Location "East US" -ResourceGroup "Default-Web-EastUS" -WindowSize 00:05:00 -MetricName "metric" -TargetResourceUri "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourcegroups/Default-Web-WestUS/providers/Microsoft.Insights/webtests/leowebtestr1-webtestr1" -Description "Nice Webtest rule" -Failed 3

RequestId                                                                                                    StatusCode
---------                                                                                                    ----------
9a5bc388-c7ac-4dc6-aa70-f4bc29c2c712                                                                                 OK

This command adds or updates a webtest alert rule.

Parameters

-Action

Specifies a comma-separated list of actions.

Type:List<T>[RuleAction]
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-DefaultProfile

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

Type:IAzureContextContainer
Aliases:AzContext, 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
Accept wildcard characters:False
-DisableRule

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

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

Specifies the failed location count for the webtest rules. This is similar to the threshold in the other types of rules.

Type:Int32
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-Location

Specifies the location where the rule is defined.

Type:String
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-MetricName

Specifies the name of the metric.

Type:String
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-MetricNamespace

Specifies the metric namespace for rule.

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

Specifies the name of the rule.

Type:String
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-ResourceGroupName

Specifies the name of the resource group.

Type:String
Aliases:ResourceGroup
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-TargetResourceUri

Specifies the resource ID of the webtest.

Type:String
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-WindowSize

Specifies the time window size for the rule to compute its data.

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

Inputs

String

TimeSpan

Int32

SwitchParameter

List<T>[[Microsoft.Azure.Management.Monitor.Management.Models.RuleAction, Microsoft.Azure.PowerShell.Cmdlets.Monitor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]

Outputs

PSAddAlertRuleOperationResponse