1
votes

I want to deploy a website (Microsoft.Web/sites) resource to a existing hosting plan (Microsoft.Web/serverfarms) without having to define the sku, workersize, etc. in the ARM template. It should just use the hosting plan as-is without changing it. But the sku seems to be required for the hosting plan definition and the hosting plan definition seems to be required for the website definition.

At the moment we read the sku of the hosting plan and set it as a parameter in the ARM template, but sometimes it still triggers a scaling operation in azure and restarts all websites on the hosting plan.

1

1 Answers

7
votes

The only thing you need in the ARM Template to set the hosting plan is the resourceId of that serverFarm - that's the serverFarmId property below...

      "name": "[variables('websiteName')]",
      "type": "Microsoft.Web/sites",
      "location": "centralus",
      "apiVersion": "2015-08-01",
      "dependsOn": [ ],
      "tags": {
          "displayName": "website"
      },
      "properties": {
          "name": "[variables('websiteName')]",
          "serverFarmId": "[resourceId(parameters('serverFarmResourceGroupName'), 'Microsoft.Web/serverFarms', parameters('AppSvcPlanName'))]"
      }

That's barebones, but it will put a web app into the existing serverFarm.