azure-powershell icon indicating copy to clipboard operation
azure-powershell copied to clipboard

New-AzResourceGroupDeployment hangs while deploying an AI Availability Test

Open c4rlosmarin opened this issue 7 years ago • 5 comments

Availability Tests ARM template deployment are hanging, having said that, the availability test is created and works with no issues.

The powershell command is the following:

New-AzResourceGroupDeployment -ResourceGroupName ARR -TemplateFile "C:\template.json" -webTestName myAvailabilityTest001 -appName myappservice001 -URL www.microsoft.com

The template (just put the pre-existing action group resource id, look for the {resourceId} tag:

{
  "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "webTestName": { "type": "string" },
    "appName": { "type": "string" },
    "URL": { "type": "string" }
  },
  "variables": {
    "alertRuleName": "[concat(parameters('webTestName'), '-', toLower(parameters('appName')), '-', subscription().subscriptionId)]",
    "testName": "[concat(parameters('webTestName'), '-', toLower(parameters('appName')))]",
    "AIInstance": "[concat('hidden-link:', resourceId('Microsoft.Insights/components', parameters('appName')))]"
  },
  "resources": [
    {
      //
      // Availability test
      //
      "name": "[variables('testName')]",
      "type": "Microsoft.Insights/webtests",
      "apiVersion": "2014-04-01",
      "location": "South Central US", // Must be Central US at present
     
      "tags": {
        "[variables('AIInstance')]": "Resource"
      },
      "properties": {
        "Name": "[parameters('webTestName')]",
        "Description": "n",
        "Enabled": true,
        "Frequency": 900, // 15 minutes
        "Timeout": 120, // 2 minutes
        "Kind": "ping", // single URL test
        "RetryEnabled": true,
        "Locations": [
          {
            "Id": "us-va-ash-azr"
          },
          {
            "Id": "emea-nl-ams-azr"
          },
          {
            "Id": "apac-jp-kaw-edge"
          }
        ],
        "Configuration": {
          "WebTest": "[concat('<WebTest   Name=\"', parameters('webTestName'), '\"   Enabled=\"True\"         CssProjectStructure=\"\"    CssIteration=\"\"  Timeout=\"120\"  WorkItemIds=\"\"         xmlns=\"http://microsoft.com/schemas/VisualStudio/TeamTest/2010\"         Description=\"\"  CredentialUserName=\"\"  CredentialPassword=\"\"         PreAuthenticate=\"True\"  Proxy=\"default\"  StopOnError=\"False\"         RecordedResultFile=\"\"  ResultsLocale=\"\">  <Items>  <Request Method=\"GET\"    Version=\"1.1\"  Url=\"', parameters('Url'),   '\" ThinkTime=\"0\"  Timeout=\"300\" ParseDependentRequests=\"True\"         FollowRedirects=\"True\" RecordResult=\"True\" Cache=\"False\"         ResponseTimeGoal=\"0\"  Encoding=\"utf-8\"  ExpectedHttpStatusCode=\"200\"         ExpectedResponseUrl=\"\" ReportingName=\"\" IgnoreHttpStatusCode=\"False\" />        </Items>   </WebTest>')]"
        },
        "SyntheticMonitorId": "[variables('testName')]"
      }
    },
    {
      //
      // Alert rule for the availability test
      //
      "name": "[variables('alertRuleName')]",
      "type": "Microsoft.Insights/alertrules",
      "apiVersion": "2014-04-01",
      "location": "South Central US", // Must be East US at present
      "dependsOn": [
        "[resourceId('Microsoft.Insights/webtests', variables('testName'))]"
      ],
      "tags": {
         "[variables('AIInstance')]": "Resource",
        "[concat('hidden-link:', resourceId('Microsoft.Insights/webtests', variables('testName')))]": "Resource"
      },
      "properties": {
        "name": "[variables('alertRuleName')]",
        "description": "alert for web test",
        "isEnabled": true,
        "condition": {
          "$type": "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.LocationThresholdRuleCondition, Microsoft.WindowsAzure.Management.Mon.Client",
          "odata.type": "Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition",
          "dataSource": {
            "$type": "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleMetricDataSource, Microsoft.WindowsAzure.Management.Mon.Client",
            "odata.type": "Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource",
            "resourceUri": "[resourceId('microsoft.insights/webtests', variables('testName'))]",
            "metricName": "GSMT_AvRaW"
          },
          "windowSize": "PT15M", // Take action if changed state for 15 minutes
          "failedLocationCount": 2
        },
        "actions": [
          {
            "actionGroupId": "{resourceId}"
          }
        ]
      }

    },
  ]
}

c4rlosmarin avatar Jul 09 '19 17:07 c4rlosmarin

@c4rlosmarin would you mind re-running the above command after setting $DebugPreference = "Continue" and sending us the corresponding debug log in a new comment?

cormacpayne avatar Jul 09 '19 22:07 cormacpayne

@cormacpayne, debug log attached.

As far as I can see it keeps showing the same HTTP Request and Response while "Checking deployment status in 5 seconds". This happens long after the deployment has completed.

output.txt

c4rlosmarin avatar Jul 10 '19 16:07 c4rlosmarin

I stumbled on this issue through Google as I had the same issue, but I found the solution. The PowerShell cmdlet was hanging for me as well. So I tried deploying through the Azure Portal. This deployment hung as well, but it did give an error message. In my case, I made a typo in the location. In your template, you might want to try typing location as "southcentralus". If that doesn't work, you can run it through the portal to find the correct error.

Ba4bes avatar Sep 04 '19 07:09 Ba4bes

@c4rlosmarin, could you check if there is the same issue on portal? or could you get error message?

dingmeng-xue avatar Apr 15 '20 11:04 dingmeng-xue

@Ba4bes thanks for your comment.

@c4rlosmarin , please try it. I'm closing this issue because it seems one improvement on service side. Please create new issue if you meet any problem.

dingmeng-xue avatar Jun 20 '20 11:06 dingmeng-xue