Azure / Azure/azure-quickstart-templates
Web test deploy with alert fails on alert rules
- Dominant language
- Bicep
- Stars
- 14.9k
- Forks
- 16.2k
- Avg merge
- 6d 21h
- Merged PRs (30d)
- 6
Description
**Issue**
I get the following error when trying to deploy a single web test with a single associated alert.
Microsoft.Insights/alertRules 'GEN_UNIQUE_8alert' failed with message 'The
16:05:12 - [ERROR] target resource id '/subscriptions/{My_Subscription_Id}/resourceGroups/{My_RG_NAME}/providers/microsoft.insights/webtests/GEN_UNIQUE
16:05:12 - [ERROR] _8' is not supported.
**My ARM**
**azureparams.json**
`{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"appName": {
"value": "someapp"
},
"emails": {
"value": [
"myId@mydomain.com"
]
},
"tests": {
"value": [
{
"name": "GEN_UNIQUE_8",
"url": "http://www.microsoft.com",
"expected": 200,
"frequency_secs": 300,
"timeout_secs": 30,
"failedLocationCount": 1,
"description": "a description for test1",
"guid": "cc1c4b95-0a39-48ce-9c7b-fa41f0fc0bee",
"locations": [{
"Id": "us-il-ch1-azr"
}]
}
]
}
}
}`
**azuredeploy.json**
`{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"appName": {
"type": "string",
"metadata": {
"description": "The name of the app insights instance that you wish to create."
}
},
"tests": {
"type": "array",
"metadata": {
"description": "The list of web tests to run. See the README for the schema of test descriptor object."
}
},
"emails": {
"type": "array",
"metadata": {
"description": "A list of strings representing the email addresses to send alerts to."
}
}
},
"variables": {
},
"resources": [
{
"apiVersion": "2015-05-01",
"name": "[parameters('appName')]",
"type": "microsoft.insights/components",
"location": "Central US",
"tags": {
"AppInsightsApp": "MyApp"
},
"properties": {
"Application_Type": "web",
"Flow_Type": "Redfield",
"Request_Source": "Unknown",
"Name": "testapp",
"ApplicationId": "[parameters('appName')]"
},
"kind": "web"
},
{
"name": "[parameters('tests')[0].name]",
"apiVersion": "2015-05-01",
"type": "microsoft.insights/webtests",
"location": "Central US",
"tags": {
"[concat('hidden-link:', resourceId('microsoft.insights/components/', parameters('appName')))]": "Resource"
},
"dependsOn": [
"[concat('microsoft.insights/components/', parameters('appName'))]"
],
"properties": {
"Name": "[parameters('tests')[0].name]",
"Description": "[parameters('tests')[0].description]",
"Enabled": true,
"Frequency": "[parameters('tests')[0].frequency_secs]",
"Timeout": "[parameters('tests')[0].timeout_secs]",
"Kind": "ping",
"Locations": "[parameters('tests')[0].locations]",
"Configuration": {
"WebTest": "[concat(' ')]"
},
"SyntheticMonitorId": "[parameters('tests')[0].name]"
}
},
{
"name": "[concat(parameters('tests')[0].name, 'alert')]",
"type": "Microsoft.Insights/alertRules",
"apiVersion": "2015-04-01",
"location": "Central US",
"tags": {
"[concat('hidden-link:', resourceId('microsoft.insights/components/', parameters('appName')))]": "Resource",
"[concat('hidden-link:', resourceId('microsoft.insights/webtests/', parameters('tests')[0].name))]": "Resource"
},
"dependsOn": [
"[concat('microsoft.insights/components/', parameters('appName'))]",
"[concat('microsoft.insights/webtests/', parameters('tests')[0].name)]"
],
"properties": {
"name": "[parameters('tests')[0].name]",
"description": "[parameters('tests')[0].description]",
"isEnabled": true,
"condition": {
"$type": "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.LocationThresholdRuleCondition, Microsoft.WindowsAzure.Management.Mon.Client",
"odata.type": "Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition",
"dataSource": {
"$type": "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleMetricDataSource, Microsoft.WindowsAzure.Management.Mon.Client",
"odata.type": "Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource",
"resourceUri": "[resourceId('microsoft.insights/webtests/', parameters('tests')[0].name)]",
"metricName": "GSMT_AvRaW"
},
"windowSize": "PT15M",
"failedLocationCount": "[parameters('tests')[0].failedLocationCount]"
},
"action": {
"$type": "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleEmailAction, Microsoft.WindowsAzure.Management.Mon.Client",
"odata.type": "Microsoft.Azure.Management.Insights.Models.RuleEmailAction",
"sendToServiceOwners": true,
"customEmails": "[parameters('emails')]"
}
}
}
]
}
`
### Repro steps
1. Deploy the above ARM template -**azuredeploy.json** and choosing **azureparams.json** as the parameter file to azure using command line or VS Azure Resource group project
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with azuredeploy.json and azureparams.json, focusing on the Microsoft.Insights/alertRules resource and its web test resourceId. Reproduce the deployment using the listed command-line or Visual Studio steps, then verify that the single web test and associated alert deploy successfully without the unsupported target resource id error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure
- Domain
- cloud, infrastructure
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 28/100