Azure / Azure/azure-powershell
Add-AzureRmWebtestAlertRule with -disableRule throw an error
- Dominant language
- C#
- Stars
- 4.8k
- Forks
- 4.3k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 51
Description
Add-AzureRmWebtestAlertRule with -disableRule throw an error, details below:
my code:
```
$alert = Get-AzureRmAlertRule -ResourceGroupName $resourceGroup `
| Where-Object {$_.Name -like '*isalive*'} `
| Where-Object {$_.Name -like "*$vmName*"}
```
```
Add-AzureRmWebtestAlertRule -Name $alert.Name `
-Location $alert.Location `
-ResourceGroupName $resourceGroup `
-WindowSize $alert.Condition.WindowSize `
-MetricName $alert.Condition.DataSource.MetricName `
-TargetResourceUri $alert.Id `
-FailedLocationCount $alert.Condition.FailedLocationCount `
-DisableRule `
-Verbose
```
Error details:
WARNING: 3:34:18 PM - The namespace for all the model classes will change from Microsoft.Azure.Management.Monitor.Management.Models to Microsoft.Azure.Management.Monitor.Models in future releases.
WARNING: 3:34:18 PM - The namespace for output classes will be uniform for all classes in future releases to make it independent of modifications in the model classes.
VERBOSE: Performing the operation "Create/update an alert rule" on target "Create/update an alert rule: azecdag02 isalive-sitecore production-2c06a496-3567-4871-a57c-2c516c0ccfef from resource group: OAT_Website".
VERBOSE: 3:34:18 PM - CreateRuleCondition: Creating location threshold rule condition (webtest rule)
VERBOSE: 3:34:18 PM - CreateSdkCallParameters: Creating rule object
Add-AzureRmWebtestAlertRule : Exception type: ErrorResponseException, Message: The setting already exists., Code: SettingAlreadyExists, Status code:Conflict, Reason phrase: Conflict At line:1 char:1 + Add-AzureRmWebtestAlertRule ` + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : CloseError: (:) [Add-AzureRmWebtestAlertRule], PSInvalidOperationException + FullyQualifiedErrorId : Microsoft.Azure.Commands.Insights.Alerts.AddAzureRmWebtestAlertRuleCommand
AzureRM.Insights version: 5.0.1
Contributor guide
Assessment
This issue has not been assessed yet.