I'm trying to create an azure template for an alert for a function.
When I deploy it I get the following unhelpful error:
BadRequest: {
"code": "InternalServerError",
"message": "Exception of type 'Microsoft.WindowsAzure.Management.Monitoring.MonitoringServiceException' was thrown."
}
I can create the alert manually, and I've copied the template syntax so I'm not really sure whats wrong. This is my template:
{
"comments": "Detect failing job",
"type": "microsoft.insights/alertrules",
"name": "scheduledeletejobfailing",
"apiVersion": "2014-04-01",
"location": "North Europe",
"scale": null,
"properties": {
"name": "scheduledeletejobfailing",
"description": "The scheduled job to delete cached files is failing",
"isEnabled": true,
"condition": {
"odata.type": "Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition",
"dataSource": {
"odata.type": "Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource",
"resourceUri": "[resourceId('microsoft.insights/components', parameters('appname'))]",
"metricNamespace": null,
"metricName": "D1-ScheduledDeleteJobChecker Failures"
},
"operator": "GreaterThanOrEqual",
"threshold": 1,
"windowSize": "PT5M"
},
"action": {
"odata.type": "Microsoft.Azure.Management.Insights.Models.RuleEmailAction",
"sendToServiceOwners": false,
"customEmails": [
"[email protected]"
]
}
},
"dependsOn": [
"[resourceId('microsoft.insights/components', parameters('appname'))]",
"[resourceId('Microsoft.Web/sites',variables('functionHostingPlanName'))]"
]
},
{
"apiVersion": "2014-04-01",
"name": "[parameters('appName')]",
"type": "microsoft.insights/components",
"location": "North Europe",
"tags": {
"[concat('hidden-link:', resourceGroup().id, '/providers/Microsoft.Web/sites/', parameters('appName'))]": "Resource"
},
"properties": {
"ApplicationId": "[parameters('appName')]",
"Request_Source": "IbizaWebAppExtensionCreate"
}
}
Note I haven't included the actual function website because it's just getting too long, but I can if it would help