3
votes

I am deploying ARM templates (Web Apps) via Azure DevOps (ARM Template Deployment) task in resource group. While executing deployment below error is coming :

 ##[section]Starting: ARM Template deployment: Resource Group scope
 ==============================================================================
 Task         : ARM template deployment
 Description  : Deploy an Azure Resource Manager (ARM) template to all the deployment scopes
 Version      : 3.1.18
 Author       : Microsoft Corporation
 Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/deploy/azure-resource-group-deployment
 ==============================================================================
 ARM Service Conection deployment scope - Subscription
 Checking if the following resource group exists: xyz.
 Resource group exists: true.
 Creating deployment parameters.
 Starting template validation.
 Deployment name is azuredeploy-xyz
 Template deployment validation was completed successfully.
 Starting Deployment.
 Deployment name is azuredeploy-xyz
 There were errors in your deployment. Error code: DeploymentFailed.
 ##[error]At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/DeployOperations for usage details.
 ##[error]Details:
 ##[error]NotFound: {
  "error": {
    "code": "BadRequest",
    "message": ""
  }
}
##[error]Task failed while creating or updating the template deployment.
##[section]Finishing: ARM Template deployment: Resource Group scope.

I went to activity log to check error root. It is coming from 'connectionstrings' and 'slotconfignames' sections under 'resources' as below :

"resources": [
           {
  "apiVersion": "2015-08-01",
  "name": "connectionstrings",
  "type": "config",
  "location": "[parameters('location')]",
  "dependsOn": [
      "[resourceId('Microsoft.Web/Sites/Slots', parameters('webSiteName'), 'stage')]"
  ],
  "properties": {
      "ConnectionString1": {
          "value": "parameters('ConnectionString1Data')",
          "type": "Custom"
      },
      "ConnectionString2": {
          "value": "parameters('ConnectionString2Data')",
          "type": "SQLAzure"
      }
  }
                },
 {
     "apiVersion": "2015-08-01",
     "name": "slotconfignames",
     "type": "config",
     "location": "[parameters('location')]",
     "dependsOn": [
         "[resourceId('Microsoft.Web/Sites/Slots', parameters('webSiteName'), 'stage')]"
     ],
     "properties": {
         "connectionStringNames": [ "ConnectionString1" ,"ConnectionString2"]
     }
 }
      ]

Activity Log

1
From dependsOn reference), Only list resources that are deployed in this template.. Since your slot already exists, you can try removing it from dependsOn.stackoverflowusrone
Did you ever find an answer to this issue? I think we are facing the same issue. Initial deployment of the template works fine, but when trying to do an incremental deployment, the template fails with the same error (that actually says right about nothing)PaulVrugt

1 Answers

0
votes

I would recommend you to install the AzureRM for Powershell, and use the Test-AzureRmResourceGroupDeployment function to test your ARM template locally before you commit and run in on your Azure Devops pipeline. So, you can troubleshoot your template and find out what's the problem. You should have details while testing it.