none
ARM template for classic alert to new alert conversion RRS feed

  • Question

  • I have created 1 web test classic alert through the Azure Portal. Now I want to convert the classic alert to the new alert .I am using the following ARM template for the same.

    { "name": "TestMetricAlert", "type": "Microsoft.Insights/metricAlerts", "apiVersion": "2018-03-01", "location": "global", "tags": {}, "properties": { "description": "Test Metric Description", "severity": 2, "enabled": true, "scopes": [ ], "evaluationFrequency": "PT5M", "windowSize": "PT5M", "targetResourceType": "Microsoft.Insights/webtests", "targetResourceRegion": "eastus", "criteria": { "additionalProperties": {}, "odata.type": "Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource" }, "dependsOn": [ "/subscriptions/a85f72bb-4bc4-4a9a-b77b-83db1cc0e1e4/resourceGroups/TestProjectRG/providers/microsoft.insights/webtests/testalert-testappinsights" ], "autoMitigate": false, "actions": [ { "actionGroupId": "/subscriptions/a85f72bb-4bc4-4a9a-b77b-83db1cc0e1e4/resourceGroups/TestProjectRG/providers/microsoft.insights/actionGroups/TestAction" } ] } }

    But during deployment I am getting the following error.

    Template deployment returned the following errors:
    11:56:16 - 11:56:15 AM - Resource Microsoft.Insights/metricAlerts 'TestMetricAlert' failed with message '{
    11:56:16 - "Code": "BadRequest",
    11:56:16 - "Message": "No object created."
    11:56:16 - }'

    Could someone help me in rectifying what is wrong here or anything needs to be changed in the ARM template.

    Wednesday, July 24, 2019 7:01 AM

All replies

  • Hi AbhijeetPandey,

    Thanks for using Azure. 

    As I look through the issue you are facing, just wanted to share as previously announced, classic alerts in Azure Monitor are being retired in September 2019 (was originally July 2019). A migration tool is available in the Azure portal to customers who use classic alert rules and who want to trigger migration themselves. Please refer to below documentation links for additional information.

    Understand the migration tool

    Use the migration tool

    Hope the above information helps. Thanks


    Wednesday, July 24, 2019 6:52 PM
    Owner
  • To add to the above, you could also refer to the sample template mentioned in this doc, or even export the template from the Azure portal to check the representation. The following template works for me:

    {
        "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
        "contentVersion": "1.0.0.0",
        "parameters": {
            "metricalerts_test_new_alerts_test_log_analytics_name": {
                "defaultValue": "test-new-alerts-test-log-analytics",
                "type": "String"
            },
            "webtests_test_new_alerts_test_log_analytics_externalid": {
                "defaultValue": "/subscriptions/xxxxx-xxxx-xxx-xxx-xxxxxxxx/resourceGroups/bhannade/providers/microsoft.insights/webtests/test-new-alerts-test-log-analytics",
                "type": "String"
            },
            "components_test_log_analytics_externalid": {
                "defaultValue": "/subscriptions/xxxxx-xxxx-xxx-xxx-xxxxxxxx/resourceGroups/bhannade/providers/microsoft.insights/components/test-log-analytics",
                "type": "String"
            }
        },
        "variables": {},
        "resources": [
            {
                "type": "microsoft.insights/metricalerts",
                "apiVersion": "2018-03-01",
                "name": "[parameters('metricalerts_test_new_alerts_test_log_analytics_name')]",
                "location": "global",
                "tags": {
                    "hidden-link:/subscriptions/xxxxx-xxxx-xxx-xxx-xxxxxxxx/resourcegroups/bhannade/providers/microsoft.insights/components/test-log-analytics": "Resource",
                    "hidden-link:/subscriptions/xxxxx-xxxx-xxx-xxx-xxxxxxxx/resourcegroups/bhannade/providers/microsoft.insights/webtests/test-new-alerts-test-log-analytics": "Resource"
                },
                "properties": {
                    "description": "[concat('Automatically created alert rule for availability test \"', parameters('metricalerts_test_new_alerts_test_log_analytics_name'), '\"')]",
                    "severity": 1,
                    "enabled": true,
                    "scopes": [
                        "[parameters('webtests_test_new_alerts_test_log_analytics_externalid')]",
                        "[parameters('components_test_log_analytics_externalid')]"
                    ],
                    "evaluationFrequency": "PT1M",
                    "windowSize": "PT5M",
                    "criteria": {
                        "odata.type": "Microsoft.Azure.Monitor.WebtestLocationAvailabilityCriteria"
                    },
                    "actions": []
                }
            }
        ]
    }

    Hope this helps!

    Friday, July 26, 2019 9:53 AM
    Moderator
  • Hello Abhijeet,

    Have you had a chance to check if any of the above options help? Please let us know otherwise and we'll be happy to assist you!

    Monday, July 29, 2019 1:14 PM
    Moderator
  • Hello Abhijeet,

    Let us know if there is anything else related to this thread that we can assist you with, else please feel free to mark and close this out if any of the above responses have been of help! Thanks again for reaching out!

    Tuesday, July 30, 2019 4:21 PM
    Moderator