Azure - 找不到服务器场

标签 azure azure-rm-template azure-resource-manager

我正在尝试部署 ARM 模板,但服务器场创建步骤失败。我从 Microsoft 网站 Microsoft docks 获取示例。我不明白为什么会这样

这是一个错误代码,我将位置从北欧更改为西欧,我尝试使用参数引发的变量。没有任何帮助。

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

}

最佳答案

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

根据消息的措辞,我认为我弄错了 serverFarmId函数应用程序上的属性。不断确保我的resourceId函数是正确的:

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

这是正确的。 问题是,我不小心将函数应用程序放置在与其引用的应用程序服务计划不同的 Azure 区域中。 值得注意的是,这个错误可能是由此引起的。

关于Azure - 找不到服务器场,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45630953/

相关文章:

azure - 在 Bicep 部署中的 AppService 上设置 `customDomainVerificationId` 属性没有效果

azure - 该表达式引用了它自己的声明,这是不允许的。bicep(BCP079) Bicep 错误

azure - 如何使用循环分配系统管理身份对 Key Vault 的访问权限?

azure - PostAsync 在控制台应用程序中工作 - 不在 SSIS 包内工作

azure - Databricks PAT token 和 secret 创建

php - Azure Key Vault 访问错误 - AADSTS700027 : Client assertion contains an invalid signature. [原因 - 通过 PHP 访问时 T(截断...)

azure - 如何在 power shell 中使用 RM 模块获取 Azure 应用程序配置访问 key

使用外部引用的 nuget 包在 Portal (CSX) 中编写的 Azure Functions 不起作用

azure - 使用幂等 ARM TEMPLATE 将两个 Azure 应用服务部署到同一应用服务计划

azure - 使用 ARM 模板部署多个资源