[英]Azure - can't find serverfarm
I am trying to deploy my ARM template and t failing on serverfarms creation step.我正在尝试部署我的 ARM 模板,但在服务器场创建步骤上失败了。 I took example from Microsoft site Microsoft docks .
我以 Microsoft 网站Microsoft docks为例。 I can't understand why it happens
我不明白为什么会这样
Here is an error code, I change location fro North to West Europe,I try with variable incited of parameter.这是一个错误代码,我将位置从北欧更改为西欧,我尝试使用变量 incited 参数。 Nothing helps.
没有任何帮助。
Resource Microsoft.Web/serverfarms 'ASE-APP-SERVICE-PLAN' failed with message '{
"Code": "NotFound",
"Message": "Server farm with name ASE-APP-SERVICE-PLAN not found.",
"Target": null,
"Details": [
{
"Message": "Server farm with name ASE-APP-SERVICE-PLAN not found."
},
{
"Code": "NotFound"
},
{
"ErrorEntity": {
"ExtendedCode": "11001",
"MessageTemplate": "Server farm with name {0} not found.",
"Parameters": [
"ASE-APP-SERVICE-PLAN"
],
"Code": "NotFound",
"Message": "Server farm with name ASE-APP-SERVICE-PLAN not found."
}
}
],
"Innererror": null
}'
Here is my simple arm template这是我的简单 arm 模板
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json",
"contentVersion": "1.0.0.0",
"parameters": {
"aseName": {
"type": "string",
"defaultValue": "ASE-TEST",
"metadata": {
"description": "Name of the App Service Environment"
}
},
"aseLocation": {
"type": "string",
"defaultValue": "West Europe",
"metadata": {
"description": "Location of the App Service Environment"
}
},
"APP-SPLANName": {
"type": "string",
"defaultValue": "ASE-APP-SERVICE-PLAN",
"metadata": {
"description": "App service plan name"
}
}
},
"variables": {
"ASE-VNetPrefix": "10.0.0.0/16",
"ASE-VNetSubnet1Name": "Subnet-1",
"ASE-VNetSubnet1Prefix": "10.0.0.0/24",
"ASE-VNET-Name": "[concat('ASE-VNET', uniqueString(resourceGroup().id))]",
"WEB-APP-ASEv2Name": "[concat('WEB-APP-ASEv2', uniqueString(resourceGroup().id))]"
},
"resources": [
{
"name": "[variables('ASE-VNET-Name')]",
"type": "Microsoft.Network/virtualNetworks",
"location": "[resourceGroup().location]",
"apiVersion": "2016-03-30",
"dependsOn": [],
"tags": {
"displayName": "ASE-VNET"
},
"properties": {
"addressSpace": {
"addressPrefixes": [
"[variables('ASE-VNetPrefix')]"
]
},
"subnets": [
{
"name": "[variables('ASE-VNetSubnet1Name')]",
"properties": {
"addressPrefix": "[variables('ASE-VNetSubnet1Prefix')]"
}
}
]
}
},
{
"apiVersion": "2015-08-01",
"type": "Microsoft.Web/hostingEnvironments",
"name": "[parameters('aseName')]",
"kind": "ASEV2",
"location": "[parameters('aseLocation')]",
"dependsOn": [
"[resourceId('Microsoft.Network/virtualNetworks', variables('ASE-VNET-Name'))]"
],
"properties": {
"name": "[parameters('aseName')]",
"location": "[parameters('aseLocation')]",
"virtualNetwork": {
"Id": "[concat('/subscriptions/',subscription().subscriptionId,'/resourceGroups/',resourceGroup().name,'/providers/Microsoft.Network/virtualNetworks/', variables('ASE-VNET-Name'))]",
"Subnet": "[variables('ASE-VNETSubnet1Name')]"
}
}
},
{
"name": "[parameters('APP-SPLANName')]",
"type": "Microsoft.Web/serverfarms",
"location": "[parameters('aseLocation')]",
"apiVersion": "2016-09-01",
"tags": {},
"properties": {
"name": "[parameters('APP-SPLANName')]",
"hostingEnvironmentProfile": {
"id": "[resourceId('Microsoft.Web/hostingEnvironments', parameters('aseName'))]"
}
},
"sku": {
"name": "I1",
"tier": "Isolated",
"size": "I1",
"family": "I",
"capacity": 0
},
"dependsOn": [
"[resourceId('Microsoft.Web/hostingEnvironments', parameters('aseName'))]"
]
},
{
"name": "[variables('WEB-APP-ASEv2Name')]",
"type": "Microsoft.Web/sites",
"location": "[resourceGroup().location]",
"apiVersion": "2016-08-01",
"tags": {},
"properties": {
"name": "[variables('WEB-APP-ASEv2Name')]",
"hostingEnvironmentProfile": {
"id": "[resourceId('Microsoft.Web/hostingEnvironments', parameters('aseName'))]"
},
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', parameters('APP-SPLANName'))]"
},
"dependsOn": [
"[resourceId('Microsoft.Web/serverfarms', parameters('APP-SPLANName'))]",
"[resourceId('Microsoft.Web/hostingEnvironments', parameters('aseName'))]"
]
}
]
} }
I also can reproduce the issue that you mentioned with you mentioned template.我也可以重现你提到的模板的问题。 I try to use Azure portal to create the service plan then I get ARM template as following
我尝试使用 Azure 门户创建服务计划,然后我得到如下的 ARM 模板
"resources": [
{
"apiVersion": "2016-03-01",
"name": "[parameters('name')]",
"type": "Microsoft.Web/serverfarms",
"location": "[parameters('location')]",
"kind": "",
"properties": {
"name": "[parameters('name')]",
"workerSize": "[parameters('workerSize')]",
"workerSizeId": "[parameters('workerSizeId')]",
"numberOfWorkers": "[parameters('numberOfWorkers')]",
"reserved": false,
"hostingEnvironment": "[parameters('hostingEnvironment')]"
},
"sku": {
"Tier": "[parameters('sku')]",
"Name": "[parameters('skuCode')]"
}
}
]
So I change the creating service farm with following code, it works correctly on my side.因此,我使用以下代码更改了创建服务场,它在我这边工作正常。
{
"type": "Microsoft.Web/serverfarms",
"sku": {
"Tier": "Isolated",
"Name": "I1"
},
"kind": "",
"name": "[parameters('APP-SPLANName')]",
"apiVersion": "2016-03-01",
"location": "[parameters('aseLocation')]",
"properties": {
"name": "[parameters('APP-SPLANName')]",
"workerSize": "Small",
"workerSizeId": 0,
"numberOfWorkers": 1,
"reserved": false,
"hostingEnvironment": "[parameters('aseName')]"
},
"dependsOn": [
"[resourceId('Microsoft.Web/hostingEnvironments', parameters('aseName'))]"
]
}
The Whole template I used:我使用的整个模板:
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json",
"contentVersion": "1.0.0.0",
"parameters": {
"aseName": {
"defaultValue": "ASE-TEST",
"type": "String",
"metadata": {
"description": "Name of the App Service Environment"
}
},
"aseLocation": {
"defaultValue": "West Europe",
"type": "String",
"metadata": {
"description": "Location of the App Service Environment"
}
},
"APP-SPLANName": {
"defaultValue": "ASE-APP-SERVICE-PLAN",
"type": "String",
"metadata": {
"description": "App service plan name"
}
}
},
"variables": {
"ASE-VNetPrefix": "10.0.0.0/16",
"ASE-VNetSubnet1Name": "Subnet-1",
"ASE-VNetSubnet1Prefix": "10.0.0.0/24",
"ASE-VNET-Name": "[concat('ASE-VNET', uniqueString(resourceGroup().id))]",
"WEB-APP-ASEv2Name": "[concat('WEB-APP-ASEv2', uniqueString(resourceGroup().id))]"
},
"resources": [
{
"type": "Microsoft.Network/virtualNetworks",
"name": "[variables('ASE-VNET-Name')]",
"apiVersion": "2016-03-30",
"location": "[resourceGroup().location]",
"tags": {
"displayName": "ASE-VNET"
},
"properties": {
"addressSpace": {
"addressPrefixes": [
"[variables('ASE-VNetPrefix')]"
]
},
"subnets": [
{
"name": "[variables('ASE-VNetSubnet1Name')]",
"properties": {
"addressPrefix": "[variables('ASE-VNetSubnet1Prefix')]"
}
}
]
},
"dependsOn": []
},
{
"type": "Microsoft.Web/hostingEnvironments",
"kind": "ASEV2",
"name": "[parameters('aseName')]",
"apiVersion": "2015-08-01",
"location": "[parameters('aseLocation')]",
"properties": {
"name": "[parameters('aseName')]",
"location": "[parameters('aseLocation')]",
"virtualNetwork": {
"Id": "[concat('/subscriptions/',subscription().subscriptionId,'/resourceGroups/',resourceGroup().name,'/providers/Microsoft.Network/virtualNetworks/', variables('ASE-VNET-Name'))]",
"Subnet": "[variables('ASE-VNETSubnet1Name')]"
}
},
"dependsOn": [
"[resourceId('Microsoft.Network/virtualNetworks', variables('ASE-VNET-Name'))]"
]
},
{
"type": "Microsoft.Web/serverfarms",
"sku": {
"Tier": "Isolated",
"Name": "I1"
},
"kind": "",
"name": "[parameters('APP-SPLANName')]",
"apiVersion": "2016-03-01",
"location": "[parameters('aseLocation')]",
"properties": {
"name": "[parameters('APP-SPLANName')]",
"workerSize": "Small",
"workerSizeId": 0,
"numberOfWorkers": 1,
"reserved": false,
"hostingEnvironment": "[parameters('aseName')]"
},
"dependsOn": [
"[resourceId('Microsoft.Web/hostingEnvironments', parameters('aseName'))]"
]
},
{
"type": "Microsoft.Web/sites",
"name": "[variables('WEB-APP-ASEv2Name')]",
"apiVersion": "2016-08-01",
"location": "[resourceGroup().location]",
"tags": {},
"properties": {
"name": "[variables('WEB-APP-ASEv2Name')]",
"hostingEnvironmentProfile": {
"id": "[resourceId('Microsoft.Web/hostingEnvironments', parameters('aseName'))]"
},
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', parameters('APP-SPLANName'))]"
},
"dependsOn": [
"[resourceId('Microsoft.Web/serverfarms', parameters('APP-SPLANName'))]",
"[resourceId('Microsoft.Web/hostingEnvironments', parameters('aseName'))]"
]
}
]
}
I ran into this same message but for a slightly different reason.我遇到了同样的消息,但原因略有不同。
Based on the wording of the message, I thought I had goofed the serverFarmId property on the function app.根据消息的措辞,我以为我弄错了函数应用程序上的serverFarmId属性。 Kept making sure that my resourceId function was correct :
一直确保我的 resourceId 函数是正确的:
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', parameters('appServicePlan').name)]"
It was correct.这是正确的。 Issue was that I accidentally had the Function App in a different Azure Region than the App Service Plan it was referencing.
问题是我不小心将 Function App 放在与它引用的应用服务计划不同的 Azure 区域中。 Worth noting that this error can be caused by that.
值得注意的是,此错误可能由此引起。
In my situation, I had the wrong location
for the server farm so the deployment process was looking at the wrong location for the service plan.在我的情况下,服务器场的
wrong location
,因此部署过程正在寻找服务计划的错误位置。 Once I fixed it, the error went away.一旦我修复它,错误就消失了。
For me, I wasn't using an ARM template but I was getting this error message because I picked a linux-based resource group, but had picked a Windows operating system for my web app deployment.对我来说,我没有使用 ARM 模板,但我收到此错误消息是因为我选择了一个基于 linux 的资源组,但为我的 Web 应用程序部署选择了一个 Windows 操作系统。 Once I switched my OS to Linux, it worked just fine.
一旦我将操作系统切换到 Linux,它就运行得很好。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.