Deploy multiple azure App Service Plans causes error "Web space with specified name already exists"

Viewed 1887

How can you deploy multiple App Service Plans in the same azure resource group project?

When I try to deploy two web application with the following resource section in the template:

"resources": [
  {
    "name": "[parameters('Plan1Name')]",
    "type": "Microsoft.Web/serverfarms",
    "location": "[resourceGroup().location]",
    "apiVersion": "2014-06-01",
    "dependsOn": [ ],
    "tags": {
      "displayName": "Plan1"
    },
    "properties": {
      "name": "[parameters('Plan1Name')]",
      "sku": "[parameters('Plan1SKU')]",
      "workerSize": "[parameters('Plan1WorkerSize')]",
      "numberOfWorkers": 1
    }
  },
  {
    "name": "[parameters('Plan2Name')]",
    "type": "Microsoft.Web/serverfarms",
    "location": "[resourceGroup().location]",
    "apiVersion": "2014-06-01",
    "dependsOn": [
    ],
    "tags": {
      "displayName": "Plan2"
    },
    "properties": {
      "name": "[parameters('Plan2Name')]",
      "sku": "[parameters('Plan2SKU')]",
      "workerSize": "[parameters('Plan2WorkerSize')]",
      "numberOfWorkers": 1
    }
  }
],

I get the following error when I deploy:

[VERBOSE] 09:26:11 - Create template deployment 'azuredeploy-0318-0926'.
[ERROR] New-AzureRmResourceGroupDeployment : 09:26:16 - Resource 
[ERROR] Microsoft.Web/serverfarms 'Plan1' failed with message 'Web space with 
[ERROR] specified name already exists.'
[ERROR] At C:\dev\src\vs2015\projects\webappplandeploy\webappplandeploy\Scripts\Deploy-
[ERROR] AzureResourceGroup.ps1:98 char:1
[ERROR] + New-AzureRmResourceGroupDeployment -Name ((Get-ChildItem $TemplateFil ...
[ERROR] + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[ERROR]     + CategoryInfo          : NotSpecified: (:) [New-AzureRmResourceGroupDeplo 
[ERROR]    yment], Exception
[ERROR]     + FullyQualifiedErrorId : Microsoft.Azure.Commands.Resources.NewAzureResou 
[ERROR]    rceGroupDeploymentCommand
[ERROR]  
[VERBOSE] 09:26:18 - Resource Microsoft.Web/serverfarms 'Plan2' provisioning status is succeeded
1 Answers
Related