簡體   English   中英

當我部署Azure ARM模板時,它將創建存儲而不是警報

[英]When i deploy my Azure ARM Template it creates a storage, not an alert

我為警報創建了Azure模板,因為我想同時使用新的微服務上傳腳本(.json)。 但是,如果我部署此.json文件,它將創建一個新存儲,而不是警報。 我使用了Powershell命令New-AzureRmResourceGroupDeployment -Name ExampleDeployment -ResourceGroupName ExampleResourceGroup -TemplateFile c:\\MyTemplates\\storage.json -storageAccountType Standard_GRS 在我的模板中,我需要定義參數kind ,這僅對於StorageBlobstorage值是可接受的,但是我不希望這兩個。 因此,我怎么能通過使用腳本.json文件創建警報,並且每個人都有一個模板,因為MS沒有提供正確的模板。

編輯:這是.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"
        }
      }
    ]
  }
}
]
}

請參考以下參考,以通過Azure資源管理器模板創建度量標准警報。 如果要創建一個單個的ARM模板,該模板先創建一個存儲帳戶,然后創建一個度量標准警報以監視創建的存儲帳戶,則應確保您具有dependsOn,以便僅在該存儲帳戶之后創建警報規則。 以下文檔引用了較新的度量標准警報,而不是經典的度量標准警報。

https://docs.microsoft.com/zh-CN/azure/monitoring-and-diagnostics/monitoring-create-metric-alerts-with-templates

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM