"Resource Microsoft.Web/sites 'yourapplication-web01'
failed with message 'Server farm with name yourappserviceplan not found.'
". Here is the reference line in the template: "serverFarmId":
"/subscriptions/xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx/resourceGroups/yourresourceid/providers/Microsoft.Web/serverfarms/
yourappserviceplan".
(where: yourapplication-web01
= the name of your web app, yourresourceid
= the name of your resource group, yourappserviceplan = the name of your app
service hosting plan)
This error
comes usually from an insufficient information in the ARM template you are
trying to deploy. If in a Web App deployment outside ASE it is enough to
reference the hosting plan which hosts the application, within an ASE you need
to specify also the information for referencing the ASE environment which
includes the hosting plan:
[template segment
for the web app definition]
{
"apiVersion": "2015-08-01",
"name": "[parameters('siteName')]",
"type": "Microsoft.Web/sites",
"location": "[parameters('location')]",
"tags": {
"displayName": "[parameters('siteName')]"
},
"properties": {
"name": "[parameters('siteName')]",
"hostingEnvironment": "[parameters('environmentName')]",
"hostingEnvironmentId": "[resourceId('Microsoft.Web/hostingEnvironments',
parameters('environmentName'))]",
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms',
parameters('hostingPlanName'))]"
}
}
So for the
parametering aspect, you will need to include the hosting plan name ('hostingPlanName') as well as the ASE name ('environmentName').
Note: if
the web site will be deployed in a different resource group, then you will need
to qualify the resource references with their resource group name:
"serverFarmId": "[resourceId(parameters('hostingPlanResourceGroupName'),
'Microsoft.Web/serverfarms', parameters('hostingPlanName'))]"That’s all. Have a good deployment!
Note: you
may find the French version of this article at http://blog.cellenza.com/cloud-2/azure/azure-app-service-environment-erreur-a-la-creation-dune-nouvelle-web-app.