簡體   English   中英

Azure - 找不到服務器場

[英]Azure - can't find serverfarm

我正在嘗試部署我的 ARM 模板,但在服務器場創建步驟上失敗了。 我以 Microsoft 網站Microsoft docks為例。 我不明白為什么會這樣

這是一個錯誤代碼,我將位置從北歐更改為西歐,我嘗試使用變量 incited 參數。 沒有任何幫助。

    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
}'

這是我的簡單 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'))]"
    ]
  }
]

}

我也可以重現你提到的模板的問題。 我嘗試使用 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')]"
            }
        }
    ]

在此處輸入圖片說明

因此,我使用以下代碼更改了創建服務場,它在我這邊工作正常。

        {
                "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'))]"
                ]
            }

在此處輸入圖片說明

我使用的整個模板:

{
    "$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'))]"
            ]
        }
    ]
}

我遇到了同樣的消息,但原因略有不同。

根據消息的措辭,我以為我弄錯了函數應用程序上的serverFarmId屬性。 一直確保我的 resourceId 函數是正確的:

"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', parameters('appServicePlan').name)]"

這是正確的。 問題是我不小心將 Function App 放在與它引用的應用服務計划不同的 Azure 區域中。 值得注意的是,此錯誤可能由此引起。

在我的情況下,服務器場的wrong location ,因此部署過程正在尋找服務計划的錯誤位置。 一旦我修復它,錯誤就消失了。

對我來說,我沒有使用 ARM 模板,但我收到此錯誤消息是因為我選擇了一個基於 linux 的資源組,但為我的 Web 應用程序部署選擇了一個 Windows 操作系統。 一旦我將操作系統切換到 Linux,它就運行得很好。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM