microsoft / PartsUnlimited

.Net Core + SQL Azure app for DevOps Scenarios
https://microsoft.github.io/PartsUnlimited/
MIT License
666 stars 1.53k forks source link

You cannot create or modify classic metric alerts for this subscription as this subscription is being migrated or has been migrated to use new metric alerts. #186

Open gbuckmaster opened 5 years ago

gbuckmaster commented 5 years ago

The ARM template provisions classic Azure Monitor alerts which will not work with subscriptions which use the new Azure Monitor.

eamonnk commented 5 years ago

Sorry for the delay getting back. Thanks for flagging. Is there a specific lab error that you are seeing at the moment related to it?

Thanks, eamonn

eamonnk commented 5 years ago

Hi Again,

have been able to complete CD labs to Azure using the current template files, so not seeing any errors on deployments related to this right now. If there's a specific scenario or lab you are encountering this on let us know and will have a look.

We're aware about the retirement of the classic alerts and will be reviewing and updating scripts where needed.

Thanks, eamonn

gbuckmaster commented 5 years ago

Hey sorry I missed your original response. Yes, it still fails to deploy in my subscription where I've already moved away from classic alerts. It works for another subscription which hasn't been migrated yet. Definitely need to transition the ARM template to handle the new alerting format.

On Wed., 26 Jun. 2019, 2:00 am eamonnk, notifications@github.com wrote:

Hi Again,

have been able to complete CD labs to Azure using the current template files, so not seeing any errors on deployments related to this right now. If there's a specific scenario or lab you are encountering this on let us know and will have a look.

We're aware about the retirement of the classic alerts and will be reviewing and updating scripts where needed.

Thanks, eamonn

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/microsoft/PartsUnlimited/issues/186?email_source=notifications&email_token=AG2W5QQBKZZ7ZSPQPILKBLDP4I6K3A5CNFSM4HOH23MKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYQXRFY#issuecomment-505510039, or mute the thread https://github.com/notifications/unsubscribe-auth/AG2W5QX4ELPYC7AXOEOKLW3P4I6K3ANCNFSM4HOH23MA .

softwaresubscription commented 4 years ago

Any update when the Json will be updated I'm also getting the same error.

mjazwiecki commented 4 years ago

Same issue: You cannot create or modify classic metric alerts for this subscription as this subscription XXX is being migrated or has been migrated to use new metric alerts

EkoGeek commented 4 years ago

Got the same error: New-AzureRmResourceGroupDeployment : Resource Microsoft.Insights/alertrules 'ForbiddenRequests TailspinToysWeb' failed with message '{ "code": "BadRequest", "message": "You cannot create or modify classic metric alerts for this subscription as this subscription XYYX is being migrated or has been migrated to use new metric alerts. Learn more - aka.ms/alertclassicretirement" }'

I was trying to do go through the following workshop: Microsoft Cloud Workshop Continuous delivery with VSTS and Azure Hands-on lab step-by-step January 2018

bgarcial commented 4 years ago

Hello, some update about this situation? Currently, I have the same problem

2019-09-19T14:23:08.9800895Z ##[section]Starting: Azure Deployment:Create Or Update Resource Group action on purgek078bg
2019-09-19T14:23:08.9915442Z ==============================================================================
2019-09-19T14:23:08.9915552Z Task         : Azure resource group deployment
2019-09-19T14:23:08.9915655Z Description  : Deploy an Azure Resource Manager (ARM) template to a resource group and manage virtual machines
2019-09-19T14:23:08.9915732Z Version      : 2.157.2
2019-09-19T14:23:08.9915811Z Author       : Microsoft Corporation
2019-09-19T14:23:08.9915916Z Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/deploy/azure-resource-group-deployment
2019-09-19T14:23:08.9916022Z ==============================================================================
2019-09-19T14:23:09.4312375Z Checking if the following resource group exists: purgek078bg.
2019-09-19T14:23:10.0814373Z Resource group exists: false.
2019-09-19T14:23:10.0816803Z Creating resource Group: purgek078bg
2019-09-19T14:23:10.8235912Z Resource Group created successfully.
2019-09-19T14:23:10.8238648Z Creating deployment parameters.
2019-09-19T14:23:10.8326698Z The detected encoding for file 'd:\a\r1\a\_Parts-Unlimited-CI-import\ARMTemplates\FullEnvironmentSetupMerged.json' is 'utf-8'
2019-09-19T14:23:10.8457337Z The detected encoding for file 'd:\a\r1\a\_Parts-Unlimited-CI-import\ARMTemplates\FullEnvironmentSetupMerged.param.json' is 'utf-8'
2019-09-19T14:23:10.8500164Z Starting Deployment.
2019-09-19T14:23:10.8525327Z Deployment name is FullEnvironmentSetupMerged-20190919-142310-5a90
2019-09-19T14:25:28.4152423Z There were errors in your deployment. Error code: DeploymentFailed.
2019-09-19T14:25:28.4227366Z ##[error]At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-debug for usage details.
2019-09-19T14:25:28.4239999Z ##[error]Details:
2019-09-19T14:25:28.4241655Z ##[error]BadRequest: {
  "code": "BadRequest",
  "message": "You cannot create or modify classic metric alerts for this subscription as this subscription xxxxxxxx is being migrated or has been migrated to use new metric alerts. Learn more - aka.ms/alertclassicretirement"
}
2019-09-19T14:25:28.4242387Z ##[error]BadRequest: {
  "code": "BadRequest",
  "message": "You cannot create or modify classic metric alerts for this subscription as this subscription xxxxxxx is being migrated or has been migrated to use new metric alerts. Learn more - aka.ms/alertclassicretirement"
}
2019-09-19T14:25:28.4247734Z ##[error]BadRequest: {
  "code": "BadRequest",
  "message": "You cannot create or modify classic metric alerts for this subscription as this subscription xxxxxxxxxx is being migrated or has been migrated to use new metric alerts. Learn more - aka.ms/alertclassicretirement"
}
2019-09-19T14:25:28.4248420Z ##[error]BadRequest: {
  "code": "BadRequest",
  "message": "You cannot create or modify classic metric alerts for this subscription as this subscription xxxxxxxxxx is being migrated or has been migrated to use new metric alerts. Learn more - aka.ms/alertclassicretirement"
}
2019-09-19T14:25:28.4250361Z ##[error]Task failed while creating or updating the template deployment.
2019-09-19T14:25:28.4279225Z ##[section]Finishing: Azure Deployment:Create Or Update Resource Group action on purgek078bg

Is this related to the outdated content of the labs here? Two months ago (July 11) someone posted this thread, but the answers from the content team does not look very hopeful

With regard to classic metric alerts, Is there something that we can do in order to complete that lab in the training program? I will be lookout to some answer here ... Thanks

bgarcial commented 4 years ago

Does someone know how can we modify the ARM template in order to work with updated alerts system in azure?

https://github.com/microsoft/PartsUnlimited/blob/master/env/Templates/FullEnvironmentSetupMerged.json#L360 Here I found some interesting resource to try

Guide about upgrade the ARM templates for metric rules https://docs.microsoft.com/en-us/azure/azure-monitor/platform/alerts-prepare-migration#api-changes https://docs.microsoft.com/en-us/azure/templates/microsoft.insights/2018-03-01/metricalerts https://samlearnsazure.blog/2019/06/14/migrating-classic-azure-alerts-to-new-alerts/

gbuckmaster commented 4 years ago

You can remove the alerts entirely from the ARM templates and then rebuild them after you deploy. It's not ideal but it works.

On Fri., 20 Sep. 2019, 12:49 am Bernardo Augusto Garcia, < notifications@github.com> wrote:

Does someone know how can we modify the ARM template in order to work with updated alerts system in azure?

https://github.com/microsoft/PartsUnlimited/blob/master/env/Templates/FullEnvironmentSetupMerged.json#L360

I know that the idea is contribute to the community and start to search the way and solve the problem, but currently is not clear for me how can we do this.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/microsoft/PartsUnlimited/issues/186?email_source=notifications&email_token=AG2W5QX2ULKHNQBFSHJS2LLQKOGPRA5CNFSM4HOH23MKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD7DXUUY#issuecomment-533166675, or mute the thread https://github.com/notifications/unsubscribe-auth/AG2W5QXKC4AWWEGE4HJUJY3QKOGPRANCNFSM4HOH23MA .

bgarcial commented 4 years ago

You can remove the alerts entirely from the ARM templates and then rebuild them after you deploy. It's not ideal but it works. On Fri., 20 Sep. 2019, 12:49 am Bernardo Augusto Garcia, < @.***> wrote: Does someone know how can we modify the ARM template in order to work with updated alerts system in azure? https://github.com/microsoft/PartsUnlimited/blob/master/env/Templates/FullEnvironmentSetupMerged.json#L360 I know that the idea is contribute to the community and start to search the way and solve the problem, but currently is not clear for me how can we do this. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <#186?email_source=notifications&email_token=AG2W5QX2ULKHNQBFSHJS2LLQKOGPRA5CNFSM4HOH23MKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD7DXUUY#issuecomment-533166675>, or mute the thread https://github.com/notifications/unsubscribe-auth/AG2W5QXKC4AWWEGE4HJUJY3QKOGPRANCNFSM4HOH23MA .

@gbuckmaster really? but the idea is create the alerts metrics, I mean in this case getting into in how to migrate them to the current infrastructure ... right?

bgarcial commented 4 years ago

I have been modifying the env/Templates/FullEnvironmentSetupMerged.json to the following code version The same release pipeline point to me to the changes (// comments section code) Most of the parts modified have a relation with the location and apiVersion of the different resource types, between them "type": "Microsoft.Web/serverfarms", "type": "Microsoft.Insights/components",

{
  "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "WebsiteName": {
      "type": "string"
    },
    "PartsUnlimitedServerName": {
      "type": "string"
    },
    "PartsUnlimitedServerAdminLogin": {
      "type": "string",
      "defaultValue": "AdminUser"
    },
    "PartsUnlimitedServerAdminLoginPassword": {
      "type": "securestring"
    },
    "PartsUnlimitedServerAdminLoginPasswordForTest": {
      "type": "securestring"
    },
    "PartsUnlimitedDBName": {
      "type": "string",
      "defaultValue": "PartsUnlimitedDB"
    },
    "PartsUnlimitedDBCollation": {
      "type": "string",
      "defaultValue": "SQL_Latin1_General_CP1_CI_AS"
    },
    "PartsUnlimitedDBEdition": {
      "type": "string",
      "defaultValue": "Basic",
      "allowedValues": [
        "Basic",
        "Business",
        "Premium",
        "Standard",
        "Web"
      ]
    },
    "PartsUnlimitedHostingPlanName": {
      "type": "string"
    },
    "PartsUnlimitedHostingPlanSKU": {
      "type": "string",
      "allowedValues": [
        "Standard"
      ],
      "defaultValue": "Standard"
    },
    "PartsUnlimitedHostingPlanWorkerSize": {
      "type": "string",
      "allowedValues": [
        "0",
        "1",
        "2"
      ],
      "defaultValue": "0"
    },
    "EnableRules": {
      "type": "bool",
      "defaultValue": false
    },
    "CdnStorageAccountName": {
      "type": "string"
    },
    "CdnStorageContainerName": {
      "type": "string"
    },
    "CdnStorageAccountNameForDev": {
      "type": "string"
    },
    "CdnStorageContainerNameForDev": {
      "type": "string"
    },
    "CdnStorageAccountNameForStaging": {
      "type": "string"
    },
    "CdnStorageContainerNameForStaging": {
      "type": "string"
    }
  },
  "variables": {
    "PartsUnlimitedServerName": "[toLower(parameters('PartsUnlimitedServerName'))]",
    "PartsUnlimitedServerNameDev": "[concat(variables('PartsUnlimitedServerName'), 'dev')]",
    "PartsUnlimitedServerNameStage": "[concat(variables('PartsUnlimitedServerName'), 'stage')]"
  },
  "resources": [
    {
      "name": "[variables('PartsUnlimitedServerName')]",
      "type": "Microsoft.Sql/servers",
      "location": "[resourceGroup().location]",
      //"apiVersion": "2014-04-01-preview",
      "apiVersion": "2018-06-01-preview",
      "tags": {
        "displayName": "PartsUnlimitedServer"
      },
      "properties": {
        "administratorLogin": "[parameters('PartsUnlimitedServerAdminLogin')]",
        "administratorLoginPassword": "[parameters('PartsUnlimitedServerAdminLoginPassword')]"
      },
      "resources": [
        {
          "name": "[concat('AllowAllIps', variables('PartsUnlimitedServerName'))]",
          "type": "firewallrules",
          "location": "[resourceGroup().location]",
          //"apiVersion": "2014-04-01-preview",
          "apiVersion": "2018-06-01-preview",
          "dependsOn": [
            "[resourceId('Microsoft.Sql/servers', variables('PartsUnlimitedServerName'))]"
          ],
          "properties": {
            "startIpAddress": "0.0.0.0",
            "endIpAddress": "0.0.0.0"
          }
        },
        {
          "name": "[parameters('PartsUnlimitedDBName')]",
          "type": "databases",
          "location": "[resourceGroup().location]",
          //"apiVersion": "2014-04-01-preview",
          "apiVersion": "2018-06-01-preview",
          "dependsOn": [
            "[resourceId('Microsoft.Sql/servers', variables('PartsUnlimitedServerName'))]"
          ],
          "tags": {
            "displayName": "PartsUnlimitedDB"
          },
          "properties": {
            "collation": "[parameters('PartsUnlimitedDBCollation')]",
            "edition": "[parameters('PartsUnlimitedDBEdition')]",
            "maxSizeBytes": "1073741824"
          }
        }
      ]
    },
    {
      "name": "[variables('PartsUnlimitedServerNameDev')]",
      "type": "Microsoft.Sql/servers",
      "location": "[resourceGroup().location]",
      "apiVersion": "2018-06-01-preview",
      //"apiVersion": "2014-04-01-preview",
      "dependsOn": [],
      "tags": {
        "displayName": "PartsUnlimitedServer"
      },
      "properties": {
        "administratorLogin": "[parameters('PartsUnlimitedServerAdminLogin')]",
        "administratorLoginPassword": "[parameters('PartsUnlimitedServerAdminLoginPasswordForTest')]"
      },
      "resources": [
        {
          "name": "[concat('AllowAllIps', variables('PartsUnlimitedServerNameDev'))]",
          "type": "firewallrules",
          "location": "[resourceGroup().location]",
          //"apiVersion": "2014-04-01-preview",
          "apiVersion": "2018-06-01-preview",
          "dependsOn": [
            "[resourceId('Microsoft.Sql/servers', variables('PartsUnlimitedServerNameDev'))]"
          ],
          "properties": {
            "startIpAddress": "0.0.0.0",
            "endIpAddress": "0.0.0.0"
          }
        },
        {
          "name": "[parameters('PartsUnlimitedDBName')]",
          "type": "databases",
          "location": "[resourceGroup().location]",
          //"apiVersion": "2014-04-01-preview",
          "apiVersion": "2018-06-01-preview",
          "dependsOn": [
            "[resourceId('Microsoft.Sql/servers', variables('PartsUnlimitedServerNameDev'))]"
          ],
          "tags": {
            "displayName": "PartsUnlimitedDB"
          },
          "properties": {
            "collation": "[parameters('PartsUnlimitedDBCollation')]",
            "edition": "[parameters('PartsUnlimitedDBEdition')]",
            "maxSizeBytes": "1073741824"
          }
        }
      ]
    },
    {
      "name": "[variables('PartsUnlimitedServerNameStage')]",
      "type": "Microsoft.Sql/servers",
      "location": "[resourceGroup().location]",
      //"apiVersion": "2014-04-01-preview",
      "apiVersion": "2018-06-01-preview",
      "dependsOn": [],
      "tags": {
        "displayName": "PartsUnlimitedServer"
      },
      "properties": {
        "administratorLogin": "[parameters('PartsUnlimitedServerAdminLogin')]",
        "administratorLoginPassword": "[parameters('PartsUnlimitedServerAdminLoginPasswordForTest')]"
      },
      "resources": [
        {
          "name": "[concat('AllowAllIps', variables('PartsUnlimitedServerNameStage'))]",
          "type": "firewallrules",
          "location": "[resourceGroup().location]",
          //"apiVersion": "2014-04-01-preview",
          "apiVersion": "2018-06-01-preview",
          "dependsOn": [
            "[resourceId('Microsoft.Sql/servers', variables('PartsUnlimitedServerNameStage'))]"
          ],
          "properties": {
            "startIpAddress": "0.0.0.0",
            "endIpAddress": "0.0.0.0"
          }
        },
        {
          "name": "[parameters('PartsUnlimitedDBName')]",
          "type": "databases",
          "location": "[resourceGroup().location]",
          //"apiVersion": "2014-04-01-preview",
          "apiVersion": "2018-06-01-preview",
          "dependsOn": [
            "[resourceId('Microsoft.Sql/servers', variables('PartsUnlimitedServerNameStage'))]"
          ],
          "tags": {
            "displayName": "PartsUnlimitedDB"
          },
          "properties": {
            "collation": "[parameters('PartsUnlimitedDBCollation')]",
            "edition": "[parameters('PartsUnlimitedDBEdition')]",
            "maxSizeBytes": "1073741824"
          }
        }
      ]
    },
    {
      "name": "[concat(parameters('WebsiteName'), '-Insights')]",
      "type": "Microsoft.Insights/components",
      "location": "eastus",
      "apiVersion": "2018-05-01-preview",
      "tags": {
        "displayName": "insightsComponents"
      },
      "properties": {
        "ApplicationId": "[concat(parameters('WebsiteName'), '-Insights')]"
      }
    },
    {
      "name": "[concat(parameters('WebsiteName'), '-DevInsights')]",
      "type": "Microsoft.Insights/components",
      "location": "eastus",
      "apiVersion": "2018-05-01-preview",
      "tags": {
        "displayName": "insightsComponents"
      },
      "properties": {
        "ApplicationId": "[concat(parameters('WebsiteName'), '-DevInsights')]"
      }
    },
    {
      "name": "[concat(parameters('WebsiteName'), '-StagingInsights')]",
      "type": "Microsoft.Insights/components",
      "location": "eastus",
      "apiVersion": "2018-05-01-preview",
      "tags": {
        "displayName": "insightsComponents"
      },
      "properties": {
        "ApplicationId": "[concat(parameters('WebsiteName'), '-StagingInsights')]"
      }
    },
    {
      "name": "[parameters('PartsUnlimitedHostingPlanName')]",
      "type": "Microsoft.Web/serverfarms",
      "location": "eastus2",
      // "location": "[resourceGroup().location]",
      // "apiVersion": "2014-06-01",
      "apiVersion": "2018-11-01",
      "dependsOn": [],
      "tags": {
        "displayName": "PartsUnlimitedHostingPlan"
      },
      "properties": {
        "name": "[parameters('PartsUnlimitedHostingPlanName')]",
        "sku": "[parameters('PartsUnlimitedHostingPlanSKU')]",
        "workerSize": "[parameters('PartsUnlimitedHostingPlanWorkerSize')]",
        "numberOfWorkers": 1
      }
    },
    {
      "name": "[concat(parameters('PartsUnlimitedHostingPlanName'), '-', resourceGroup().name)]",
      "type": "Microsoft.Insights/autoscalesettings",
      "location": "eastus",
      "apiVersion": "2014-04-01",
      "dependsOn": [
        "[resourceId('Microsoft.Web/serverfarms', parameters('PartsUnlimitedHostingPlanName'))]"
      ],
      "tags": {
        "[concat('hidden-link:', resourceGroup().id, '/providers/Microsoft.Web/serverfarms/', parameters('PartsUnlimitedHostingPlanName'))]": "Resource",
        "displayName": "WebsiteHostingPlanAutoScale"
      },
      "properties": {
        "name": "[concat(parameters('PartsUnlimitedHostingPlanName'), '-', resourceGroup().name)]",
        "profiles": [
          {
            "name": "Default",
            "capacity": {
              "minimum": "1",
              "maximum": "4",
              "default": "1"
            },
            "rules": [
              {
                "metricTrigger": {
                  "metricName": "CpuPercentage",
                  "metricResourceUri": "[concat(resourceGroup().id, '/providers/Microsoft.Web/serverfarms/', parameters('PartsUnlimitedHostingPlanName'))]",
                  "timeGrain": "PT1M",
                  "statistic": "Average",
                  "timeWindow": "PT10M",
                  "timeAggregation": "Average",
                  "operator": "GreaterThan",
                  "threshold": 80
                },
                "scaleAction": {
                  "direction": "Increase",
                  "type": "ChangeCount",
                  "value": "1",
                  "cooldown": "PT10M"
                }
              },
              {
                "metricTrigger": {
                  "metricName": "CpuPercentage",
                  "metricResourceUri": "[concat(resourceGroup().id, '/providers/Microsoft.Web/serverfarms/', parameters('PartsUnlimitedHostingPlanName'))]",
                  "timeGrain": "PT1M",
                  "statistic": "Average",
                  "timeWindow": "PT1H",
                  "timeAggregation": "Average",
                  "operator": "LessThan",
                  "threshold": 60
                },
                "scaleAction": {
                  "direction": "Decrease",
                  "type": "ChangeCount",
                  "value": "1",
                  "cooldown": "PT1H"
                }
              }
            ]
          }
        ],
        "enabled": "[parameters('EnableRules')]",
        "targetResourceUri": "[concat(resourceGroup().id, '/providers/Microsoft.Web/serverfarms/', parameters('PartsUnlimitedHostingPlanName'))]"
      }
    },
    {
      "name": "[concat('CPUHigh ', parameters('PartsUnlimitedHostingPlanName'))]",
      // "type": "Microsoft.Insights/alertrules",
      "type": "microsoft.insights/metricalerts",
      "location": "global",
      // "apiVersion": "2014-04-01",
      "apiVersion": "2018-03-01",
      "dependsOn": [
        "[resourceId('Microsoft.Web/serverfarms', parameters('PartsUnlimitedHostingPlanName'))]"
      ],
      "tags": {
        "[concat('hidden-link:', resourceGroup().id, '/providers/Microsoft.Web/serverfarms/', parameters('PartsUnlimitedHostingPlanName'))]": "Resource",
        "displayName": "WebsiteHostingPlanAlertRuleCPUHigh"
      },
      "properties": {
        "name": "[concat('CPUHigh ', parameters('PartsUnlimitedHostingPlanName'))]",
        "description": "[concat('The average CPU is high across all the instances of ', parameters('PartsUnlimitedHostingPlanName'))]",
        "isEnabled": "[parameters('EnableRules')]",
        "condition": {
          "odata.type": "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.ThresholdRuleCondition",
          "dataSource": {
            "odata.type": "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleMetricDataSource",
            "resourceUri": "[concat(resourceGroup().id, '/providers/Microsoft.Web/serverfarms/', parameters('PartsUnlimitedHostingPlanName'))]",
            "metricName": "CpuPercentage"
          },
          "operator": "GreaterThan",
          "threshold": 90,
          "windowSize": "PT15M"
        },
        "action": {
          "odata.type": "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleEmailAction",
          "sendToServiceOwners": true,
          "customEmails": []
        }
      }
    },
    {
      "name": "[concat('LongHttpQueue ', parameters('PartsUnlimitedHostingPlanName'))]",
      //"type": "Microsoft.Insights/alertrules",
      "type": "microsoft.insights/metricalerts",
      "location": "global",
      // "apiVersion": "2014-04-01",
      "apiVersion": "2018-03-01",
      "dependsOn": [
        "[resourceId('Microsoft.Web/serverfarms', parameters('PartsUnlimitedHostingPlanName'))]"
      ],
      "tags": {
        "[concat('hidden-link:', resourceGroup().id, '/providers/Microsoft.Web/serverfarms/', parameters('PartsUnlimitedHostingPlanName'))]": "Resource",
        "displayName": "WebsiteHostingPlanAlertRuleLongHttpQueue"
      },
      "properties": {
        "name": "[concat('LongHttpQueue ', parameters('PartsUnlimitedHostingPlanName'))]",
        "description": "[concat('The HTTP queue for the instances of ', parameters('PartsUnlimitedHostingPlanName'), ' has a large number of pending requests.')]",
        "isEnabled": "[parameters('EnableRules')]",
        "condition": {
          "odata.type": "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.ThresholdRuleCondition",
          "dataSource": {
            "odata.type": "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleMetricDataSource",
            "resourceUri": "[concat(resourceGroup().id, '/providers/Microsoft.Web/serverfarms/', parameters('PartsUnlimitedHostingPlanName'))]",
            "metricName": "HttpQueueLength"
          },
          "operator": "GreaterThan",
          "threshold": 100,
          "windowSize": "PT5M"
        },
        "action": {
          "odata.type": "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleEmailAction",
          "sendToServiceOwners": true,
          "customEmails": []
        }
      }
    },
    {
      "name": "[parameters('WebSiteName')]",
      "type": "Microsoft.Web/sites",
      "dependsOn": [
        "[resourceId('Microsoft.Web/serverfarms', parameters('PartsUnlimitedHostingPlanName'))]",
        "[resourceId('Microsoft.Sql/servers', variables('PartsUnlimitedServerName'))]",
        "[resourceId('Microsoft.Sql/servers', variables('PartsUnlimitedServerNameDev'))]",
        "[resourceId('Microsoft.Sql/servers', variables('PartsUnlimitedServerNameStage'))]",
        "[resourceId('Microsoft.Insights/components', concat(parameters('WebsiteName'), '-Insights'))]",
        "[resourceId('Microsoft.Insights/components', concat(parameters('WebSiteName'), '-DevInsights'))]",
        "[resourceId('Microsoft.Insights/components', concat(parameters('WebSiteName'), '-StagingInsights'))]"
      ],
      "location": "[resourceGroup().location]",
      "apiVersion": "2018-03-01",
      "tags": {
        "[concat('hidden-related:', resourceGroup().id, '/providers/Microsoft.Web/serverfarms/', parameters('PartsUnlimitedHostingPlanName'))]": "Resource",
        "displayName": "PartsUnlimitedWebsite"
      },
      "properties": {
        "name": "[parameters('WebsiteName')]",
        "serverFarm": "[parameters('PartsUnlimitedHostingPlanName')]"
      },
      "resources": [
        {
          "name": "connectionstrings",
          "type": "config",
          "apiVersion": "2018-03-01",
          "dependsOn": [
            "[resourceId('Microsoft.Web/sites/', parameters('WebSiteName'))]"
          ],
          "properties": {
            "DefaultConnectionString": {
              "value": "[concat('Data Source=tcp:', reference(concat('Microsoft.Sql/servers/', variables('PartsUnlimitedServerName'))).fullyQualifiedDomainName, ',1433;Initial Catalog=', parameters('PartsUnlimitedDBName'), ';User Id=', parameters ('PartsUnlimitedServerAdminLogin'), '@', variables('PartsUnlimitedServerName'), ';Password=', parameters('PartsUnlimitedServerAdminLoginPassword'), ';')]",
              "type": "SQLAzure"
            }
          }
        },
        {
          "name": "appsettings",
          "type": "config",
          "apiVersion": "2018-03-01",
          "dependsOn": [
            "[resourceId('Microsoft.Web/sites', parameters('WebSiteName'))]"
          ],
          "properties": {
            "APPINSIGHTS_INSTRUMENTATIONKEY": "[reference(concat('Microsoft.Insights/components/', parameters('WebsiteName'), '-Insights')).InstrumentationKey]",
            "Keys:ApplicationInsights:InstrumentationKey": "[reference(concat('Microsoft.Insights/components/', parameters('WebsiteName'), '-Insights')).InstrumentationKey]"
          }
        },
        {
          "name": "slotconfignames",
          "type": "config",
          "apiVersion": "2018-03-01",
          "dependsOn": [
            "[resourceId('Microsoft.Web/sites', parameters('WebSiteName'))]"
          ],
          "properties": {
            "connectionStringNames": [
              "DefaultConnectionString"
            ],
            "appSettingNames": [
              "APPINSIGHTS_INSTRUMENTATIONKEY",
              "Keys:ApplicationInsights:InstrumentationKey"
            ]
          }
        },
        {
          "name": "Dev",
          "type": "slots",
          "location": "[resourceGroup().location]",
          "apiVersion": "2018-03-01",
          "dependsOn": [
            "[resourceId('Microsoft.Web/sites', parameters('WebSiteName'))]"
          ],
          "properties": {},
          "resources": [
            {
              "name": "connectionstrings",
              "type": "config",
              "apiVersion": "2018-03-01",
              "dependsOn": [
                "[resourceId('Microsoft.Web/sites/slots', parameters('WebSiteName'), 'Dev')]"
              ],
              "properties": {
                "DefaultConnectionString": {
                  "value": "[concat('Data Source=tcp:', reference(concat('Microsoft.Sql/servers/', variables('PartsUnlimitedServerNameDev'))).fullyQualifiedDomainName, ',1433;Initial Catalog=', parameters('PartsUnlimitedDBName'), ';User Id=', parameters ('PartsUnlimitedServerAdminLogin'), '@', variables('PartsUnlimitedServerNameDev'), ';Password=', parameters('PartsUnlimitedServerAdminLoginPasswordForTest'), ';')]",
                  "type": "SQLAzure"
                }
              }
            },
            {
              "name": "appsettings",
              "type": "config",
              "apiVersion": "2018-03-01",
              "dependsOn": [
                "[resourceId('Microsoft.Web/sites/slots', parameters('WebSiteName'), 'Dev')]"
              ],
              "properties": {
                "APPINSIGHTS_INSTRUMENTATIONKEY": "[reference(concat('Microsoft.Insights/components/', parameters('WebsiteName'), '-DevInsights')).InstrumentationKey]",
                "Keys:ApplicationInsights:InstrumentationKey": "[reference(concat('Microsoft.Insights/components/', parameters('WebsiteName'), '-DevInsights')).InstrumentationKey]"
              }
            }
          ]
        },
        {
          "name": "Staging",
          "type": "slots",
          "location": "[resourceGroup().location]",
          "apiVersion": "2018-03-01",
          "dependsOn": [
            "[resourceId('Microsoft.Web/sites', parameters('WebSiteName'))]"
          ],
          "properties": {},
          "resources": [
            {
              "name": "connectionstrings",
              "type": "config",
              "apiVersion": "2018-03-01",
              "dependsOn": [
                "[resourceId('Microsoft.Web/sites/slots', parameters('WebSiteName'), 'Staging')]"
              ],
              "properties": {
                "DefaultConnectionString": {
                  "value": "[concat('Data Source=tcp:', reference(concat('Microsoft.Sql/servers/', variables('PartsUnlimitedServerNameStage'))).fullyQualifiedDomainName, ',1433;Initial Catalog=', parameters('PartsUnlimitedDBName'), ';User Id=', parameters ('PartsUnlimitedServerAdminLogin'), '@', variables('PartsUnlimitedServerNameStage'), ';Password=', parameters('PartsUnlimitedServerAdminLoginPasswordForTest'), ';')]",
                  "type": "SQLAzure"
                }
              }
            },
            {
              "name": "appsettings",
              "type": "config",
              "apiVersion": "2018-03-01",
              "dependsOn": [
                "[resourceId('Microsoft.Web/sites/slots', parameters('WebSiteName'), 'Staging')]"
              ],
              "properties": {
                "APPINSIGHTS_INSTRUMENTATIONKEY": "[reference(concat('Microsoft.Insights/components/', parameters('WebsiteName'), '-StagingInsights')).InstrumentationKey]",
                "Keys:ApplicationInsights:InstrumentationKey": "[reference(concat('Microsoft.Insights/components/', parameters('WebsiteName'), '-StagingInsights')).InstrumentationKey]"
              }
            }
          ]
        }
      ]
    },
    {
      "name": "[concat('ServerErrors ', parameters('WebsiteName'))]",
      // "type": "Microsoft.Insights/alertrules",
      "type": "microsoft.insights/metricalerts",
      "location": "global",
      // "apiVersion": "2014-04-01",
      "apiVersion": "2018-03-01", 
      "dependsOn": [
        "[resourceId('Microsoft.Web/sites', parameters('WebSiteName'))]"
      ],
      "tags": {
        "[concat('hidden-link:', resourceGroup().id, '/providers/Microsoft.Web/sites/', parameters('WebsiteName'))]": "Resource",
        "displayName": "WebsiteAlertRuleServerErrors"
      },
      "properties": {
        "name": "[concat('ServerErrors ', parameters('WebsiteName'))]",
        "description": "[concat(parameters('WebsiteName'), ' has some server errors, status code 5xx.')]",
        "isEnabled": "[parameters('EnableRules')]",
        "condition": {
          "odata.type": "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.ThresholdRuleCondition",
          "dataSource": {
            "odata.type": "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleMetricDataSource",
            "resourceUri": "[concat(resourceGroup().id, '/providers/Microsoft.Web/sites/', parameters('WebsiteName'))]",
            "metricName": "Http5xx"
          },
          "operator": "GreaterThan",
          "threshold": 0,
          "windowSize": "PT5M"
        },
        "action": {
          "odata.type": "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleEmailAction",
          "sendToServiceOwners": true,
          "customEmails": []
        }
      }
    },
    {
      "name": "[concat('ForbiddenRequests ', parameters('WebsiteName'))]",
      // "type": "Microsoft.Insights/alertrules",
      "type": "microsoft.insights/metricalerts",
      "location": "global",
      // "apiVersion": "2014-04-01",
      "apiVersion": "2018-03-01",
      "dependsOn": [
        "[resourceId('Microsoft.Web/sites', parameters('WebsiteName'))]"
      ],
      "tags": {
        "displayName": "WebsiteAlertRuleForbiddenRequests"
      },
      "properties": {
        "name": "[concat('ForbiddenRequests ', parameters('WebsiteName'))]",
        "description": "[concat(parameters('WebsiteName'), ' has some requests that are forbidden, status code 403.')]",
        "isEnabled": "[parameters('EnableRules')]",
        "condition": {
          "odata.type": "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.ThresholdRuleCondition",
          "dataSource": {
            "odata.type": "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleMetricDataSource",
            "resourceUri": "[concat(resourceGroup().id, '/providers/Microsoft.Web/sites/', parameters('WebsiteName'))]",
            "metricName": "Http403"
          },
          "operator": "GreaterThan",
          "threshold": 0,
          "windowSize": "PT5M"
        },
        "action": {
          "odata.type": "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleEmailAction",
          "sendToServiceOwners": true,
          "customEmails": []
        }
      }
    }
  ]
}

So I have an error and I am not sure the origin of that, but it's not related anymore with the classic metrics creation.

2019-09-20T00:17:21.4888914Z ##[section]Starting: Azure Deployment:Create Or Update Resource Group action on purgek078bg
2019-09-20T00:17:21.5002791Z ==============================================================================
2019-09-20T00:17:21.5002909Z Task         : Azure resource group deployment
2019-09-20T00:17:21.5003009Z Description  : Deploy an Azure Resource Manager (ARM) template to a resource group and manage virtual machines
2019-09-20T00:17:21.5003087Z Version      : 2.157.2
2019-09-20T00:17:21.5003165Z Author       : Microsoft Corporation
2019-09-20T00:17:21.5003269Z Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/deploy/azure-resource-group-deployment
2019-09-20T00:17:21.5003375Z ==============================================================================
2019-09-20T00:17:21.9217910Z Checking if the following resource group exists: purgek078bg.
2019-09-20T00:17:22.1230744Z Resource group exists: false.
2019-09-20T00:17:22.1233664Z Creating resource Group: purgek078bg
2019-09-20T00:17:23.0848003Z Resource Group created successfully.
2019-09-20T00:17:23.0851146Z Creating deployment parameters.
2019-09-20T00:17:23.0943655Z The detected encoding for file 'd:\a\r1\a\_Parts-Unlimited-CI-import\ARMTemplates\FullEnvironmentSetupMerged.json' is 'utf-8'
2019-09-20T00:17:23.1064417Z The detected encoding for file 'd:\a\r1\a\_Parts-Unlimited-CI-import\ARMTemplates\FullEnvironmentSetupMerged.param.json' is 'utf-8'
2019-09-20T00:17:23.1168213Z Starting Deployment.
2019-09-20T00:17:23.1195473Z Deployment name is FullEnvironmentSetupMerged-20190920-001723-2fc8
2019-09-20T00:19:10.7714557Z There were errors in your deployment. Error code: DeploymentFailed.
2019-09-20T00:19:10.7790397Z ##[error]At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-debug for usage details.
2019-09-20T00:19:10.7799336Z ##[error]Details:
2019-09-20T00:19:10.7800736Z ##[error]BadRequest: {
  "Code": "BadRequest",
  "Message": "The parameter sku has an invalid value.",
  "Target": null,
  "Details": [
    {
      "Message": "The parameter sku has an invalid value."
    },
    {
      "Code": "BadRequest"
    },
    {
      "ErrorEntity": {
        "ExtendedCode": "51008",
        "MessageTemplate": "The parameter {0} has an invalid value.",
        "Parameters": [
          "sku"
        ],
        "Code": "BadRequest",
        "Message": "The parameter sku has an invalid value."
      }
    }
  ],
  "Innererror": null
}
2019-09-20T00:19:10.7805330Z ##[error]Task failed while creating or updating the template deployment.
2019-09-20T00:19:10.7838535Z ##[section]Finishing: Azure Deployment:Create Or Update Resource Group action on purgek078bg

The release pipeline point me to this https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-manager-common-deployment-errors

I will be checking

snpdev commented 4 years ago

I just hit the same problem. This issue is still open?! Bill Palmer is not pleased :wink:

misterj3012 commented 4 years ago

Also facing the same problem during the MPP for DevOps.^^

eamonnk commented 4 years ago

Have pushed up an update to the file PartsUnlimited file \env\Templates\FullEnvironmentSetupMerged.json

The classic alerts as defined in this arm template have been migrated over to the new metric alerts definition format. It looks like the json is deploying fine and the new alerts are being created successfully. Can you try this updated template and see if it works for you.

Thanks, Eamonn