ARM模板资源microsoft.web/sites http请求不能为空

ARM template resource microsoft.web/sites http request must not be empty

尝试使用我在 ARM 模板的 属性 部分中重复的多个主机名从 Azure 密钥保管库应用证书,但失败并显示消息 "HTTP request body must not be empty"

我的 ARM 模板如下所示:

{
  "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "appServiceName": {
      "type": "string",
      "metadata": {
        "description": "Name of app service to apply SSL to."
      }
    },
    "certificateName": {
      "type": "string",
      "metadata": {
        "description": "User friendly certificate resource name"
      }
    },
    "appServicePlan": {
      "type": "string",
      "metadata": {
        "description": "App Service Plan Name"
      }
    },
    "keyVaultId": {
      "type": "string",
      "metadata": {
        "description": "Existing Key Vault resource Id with an access policy to allow Microsoft.Web RP to read Key Vault secrets (Checkout README.md for more information)"
      }
    },
    "hostname": {
      "type": "array",
      "metadata": {
        "description": "Custom hostname for creating SSL binding. This hostname should already be assigned to the Web App"
      }
    }
  },
  "resources": [
    {
      "apiVersion": "2016-03-01",
      "type": "Microsoft.Web/sites",
      "name": "[parameters('appServiceName')]",
      "location": "[resourceGroup().location]",
      "dependsOn": [
        "[resourceId('Microsoft.Web/certificates', parameters('certificateName'))]"
      ],
      "properties": {
        "copy": [
          {
            "name": "hostnames",
            "count": "[length(parameters('hostname'))]",
            "input": {
              "name": "[copyIndex('hostnames')]",
              "properties": {
                "hostNameSslStates": [
                  {
                    "name": "[parameters('hostname')[copyIndex('hostnames')]]",
                    "sslState": "SniEnabled",
                    "thumbprint": "[reference(resourceId('Microsoft.Web/certificates', parameters('certificateName'))).Thumbprint]",
                    "toUpdate": true
                  }
                ]
              }
            }
          }
        ]
      }
    },
    {
      "type": "Microsoft.Web/certificates",
      "name": "[parameters('certificateName')]",
      "apiVersion": "2016-03-01",
      "location": "[resourceGroup().location]",
      "properties": {
        "keyVaultId": "[parameters('keyVaultId')]",
        "keyVaultSecretName": "[parameters('certificateName')]",
        "serverFarmId": "[resourceId('Microsoft.Web/serverfarms',parameters('appServicePlan'))]"
      }
    }
  ]
}

我得到的错误是:

New-AzureRmResourceGroupDeployment:资源 Microsoft。Web/sites 'developapp' 失败,消息为“{ "Code": "BadRequest", "Message": "HTTP request body must not be empty.", "Target":空, "Details":[ { "Message": "HTTP request body must not be empty." }, { "Code": "BadRequest" }, { "ErrorEntity":{ "ExtendedCode": "51016", "MessageTemplate": "HTTP request body must not be empty.", "Parameters": [], "Code": "BadRequest", "Message": "HTTP request body must not be empty." } } ], "Innererror": 空 }' 在 line:1 char:1 + New-AzureRmResourceGroupDeployment -名称测试 -ResourceGroupName 开发 ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [New-AzureRmResourceGroupDeployment], 异常 + FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResourceGroupDeploymentCmdlet

详细:13:52:43 - 资源 Microsoft.Web/certificates 'testCert' 配置状态成功 New-AzureRmResourceGroupDeployment:13:52:43 - 模板输出评估已跳过:至少一个资源部署 ent 操作失败。请列出部署操作以获取详细信息。请参阅 https://aka.ms/arm-debug 了解用法 e 细节。 在 line:1 char:1 + New-AzureRmResourceGroupDeployment -名称测试 -ResourceGroupName 开发 ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [New-AzureRmResourceGroupDeployment], 异常 + FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResourceGroupDeploymentCmdlet

New-AzureRmResourceGroupDeployment:13:52:43 - 跳过模板输出评估:至少一个资源部署 ent 操作失败。请列出部署操作以获取详细信息。请参阅 https://aka.ms/arm-debug 了解用法 e 细节。 在 line:1 char:1 + New-AzureRmResourceGroupDeployment -名称测试 -ResourceGroupName 开发 ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [New-AzureRmResourceGroupDeployment], 异常 + FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResourceGroupDeploymentCmdlet

你们中的任何人对可能导致这种情况的原因有什么建议吗?提前致谢!

试试这个而不是你的副本:

"copy": [
    {
        "name": "hostNameSslStates",
        "count": "[length(parameters('hostname'))]",
        "input": {
            "name": "[parameters('hostname')[copyIndex('hostNameSslStates')]]",
            "sslState": "SniEnabled",
            "thumbprint": "[reference(resourceId('Microsoft.Web/certificates', parameters('certificateName'))).Thumbprint]",
            "toUpdate": true
        }
    }
]