[英]When i deploy my Azure ARM Template it creates a storage, not an alert
I created a Azure Template for an alert, because i want to upload the script (.json) with the new microservice the same time. 我为警报创建了Azure模板,因为我想同时使用新的微服务上传脚本(.json)。 But if I deploy this .json file it creates a new storage, not an alert. 但是,如果我部署此.json文件,它将创建一个新存储,而不是警报。 I used the Powershell commands New-AzureRmResourceGroupDeployment -Name ExampleDeployment -ResourceGroupName ExampleResourceGroup -TemplateFile c:\\MyTemplates\\storage.json -storageAccountType Standard_GRS
. 我使用了Powershell命令New-AzureRmResourceGroupDeployment -Name ExampleDeployment -ResourceGroupName ExampleResourceGroup -TemplateFile c:\\MyTemplates\\storage.json -storageAccountType Standard_GRS
。 In my template i need to define the parameter kind
, which is only acceptable with a value of Storage
or Blobstorage
, but i want non of these two. 在我的模板中,我需要定义参数kind
,这仅对于Storage
或Blobstorage
值是可接受的,但是我不希望这两个。 So how can i create an alert by using a script .json file and does anybody have a template, because MS isn't providing the correct one. 因此,我怎么能通过使用脚本.json文件创建警报,并且每个人都有一个模板,因为MS没有提供正确的模板。
EDIT: Here is the .json file: 编辑:这是.json文件:
{
"$schema":
"http://schema.management.azure.com/schemas/2015-01-
01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"name": "[concat('storage', uniqueString(resourceGroup().id))]",
"type": "Microsoft.Storage/storageAccounts",
"apiVersion": "2016-01-01",
"sku": {
"name": "Standard_LRS"
},
"kind": "Storage",
"id":
"/subscriptions/subscriptionID/resourceGroups/resourceGroupName/providers/Microsoft.Storage/storageAccounts/storageName",
"location": "westeurope",
"properties": {
"name": "tryAgain",
"description": null,
"isEnabled": true,
"condition": {
"$type":
"Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.ThresholdRuleCondition, Microsoft.WindowsAzure.Management.Mon.Client",
"odata.type":
"Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition",
"dataSource": {
"$type":
"Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleMetricDataSource, Microsoft.WindowsAzure.Management.Mon.Client",
"odata.type":
"Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource",
"resourceUri":
"/subscriptions/subscriptionID/resourcegroups/resourceGroupName/providers/microsoft.web/sites/name",
"resourceLocation": null,
"metricNamespace": null,
"metricName": "AverageMemoryWorkingSet",
"legacyResourceId": null
},
"operator": "GreaterThanOrEqual",
"threshold": 120000000,
"windowSize": "PT10M",
"timeAggregation": "Average"
},
"actions": [
{
"$type":
"Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleWebhookAction, Microsoft.WindowsAzure.Management.Mon.Client",
"odata.type":
"Microsoft.Azure.Management.Insights.Models.RuleWebhookAction",
"serviceUri":
"Logic-app URL",
"properties": {
"$type":
"Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary`1[[System.String, mscorlib]], Microsoft.WindowsAzure.Management.Common.Storage",
"logicAppResourceId":
"/subscriptions/subscriptionID/resourceGroups/Default-Storage-WestEurope/providers/Microsoft.Logic/workflows/Microsoft-Teams-Notifier"
}
}
]
}
}
]
}
Please refer to the following reference for creating a metric alert via Azure Resource Manager template. 请参考以下参考,以通过Azure资源管理器模板创建度量标准警报。 If you want to create a single ARM template which creates a storage account and then a metric alert to monitor the created storage account, you should make sure you have a dependsOn so that the alert rule is only created after the storage account. 如果要创建一个单个的ARM模板,该模板先创建一个存储帐户,然后创建一个度量标准警报以监视创建的存储帐户,则应确保您具有dependsOn,以便仅在该存储帐户之后创建警报规则。 The following document references the newer metric alerts, as opposed to the classic metric alerts. 以下文档引用了较新的度量标准警报,而不是经典的度量标准警报。
https://docs.microsoft.com/en-us/azure/monitoring-and-diagnostics/monitoring-create-metric-alerts-with-templates https://docs.microsoft.com/zh-CN/azure/monitoring-and-diagnostics/monitoring-create-metric-alerts-with-templates
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.