Reputation: 308
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://learn.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"]
}
}
]
Upvotes: 5
Views: 10689
Reputation: 1
I'm assuming you are trying to deploy a configuration (app setting/connection string) for a web app and its web app slot. In this case you will need to specify something like the following. I.e. you add a property to set these configurations. If you e.g. would like to add a mount point, you could deploy a separate resource of type "type": "Microsoft.Web/sites/config"
and "type": "Microsoft.Web/sites/slots/config"
respectively.
Web App:
"resources": [
{"name": "yourWebAppName",
"type": "Microsoft.Web/sites",
"apiVersion": "2018-11-01",
"location": "resourceLocation",
"kind": "functionapp,linux",
"dependsOn": [
"[resourceId('Microsoft.Web/serverfarms', yourAppServicePlanName)]"
],
"properties": {
"siteConfig": {
"connectionStrings": [
{
"name": "ConnString1",
"connectionString": "Server=myServerAddress;Database=myDataBase;Trusted_Connection=True;"
}
]
}
}
}
]
Web app slot:
"resources": [
{"name": "concat[ yourWebAppName ,'/', yourSlotName ]",
"type": "Microsoft.Web/sites/slots",
"apiVersion": "2020-12-01",
"location": "resourceLocation",
"kind": "functionapp,linux",
"dependsOn": [
"[resourceId('Microsoft.Web/serverfarms', yourAppServicePlanName)]"
],
"properties": {
"siteConfig": {
"connectionStrings": [
{
"name": "ConnString1",
"connectionString": "Server=myServerAddress;Database=myDataBase;Trusted_Connection=True;"
}
]
}
}
}
]
Upvotes: 0
Reputation: 1398
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.
Upvotes: 0