简体   繁体   English

当我部署Azure ARM模板时,它将创建存储而不是警报

[英]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 ,这仅对于StorageBlobstorage值是可接受的,但是我不希望这两个。 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.

相关问题 在Azure失败,JSON / ARM模板问题上部署Cloudera集群 - Deploy Cloudera cluster on azure FAILED , JSON/ARM template issue 在azure FAILED上部署cloudera,JSON / ARM模板函数'copyIndex'错误 - deploy cloudera on azure FAILED, error with JSON / ARM template function 'copyIndex' Azure ARM 模板“VmAgentNotRunning” - Azure ARM template "VmAgentNotRunning" Terraform - 使用 ARM 模板部署 Azure AD 域服务 (AADDS) 使用“azurerm_template_deployment” - Terraform - Using an ARM template to deploy Azure AD Domain Service (AADDS) using “azurerm_template_deployment” 使用 ARM 模板和 JSON 在 Azure 中创建 VM 时出现“DiskImageNotReady”错误 - "DiskImageNotReady" error when creating VM in Azure using ARM template and JSON 尝试使用ARM模板在Azure中部署应用程序网关,但在创建时无法引用侦听器 - Trying to deploy an application gateway in azure with ARM template but it can't refernece the Listener at creation Azure ARM 模板变量条件 - Azure ARM Template variable conditions 带AND运算符的Azure ARM模板条件 - Azure ARM Template Condition with AND operator 使用 arm 模板部署存储帐户时遇到问题 - I am facing an issue while deploy storage account using arm templates Azure ARM模板 - 访问由另一个ARM模板中的一个ARM模板创建的资源ID - Azure ARM Template - accessing a resource Id created by one ARM template in another ARM template
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM