title: ARM template resource microsoft.web/sites http request must not be empty
body: <p>Trying to apply certificate from Azure key vault using multiple hostnames that I iterate in property section of the ARM template but it fails with message "HTTP request body must not be empty"</p>
  
  <p>My ARM template looks like this:</p>
  
  <pre><code>{
    "$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'))]"
        }
      }
    ]
  }
  </code></pre>
  
  <p>And the error I get:</p>
  
  <p>New-AzureRmResourceGroupDeployment : Resource Microsoft.Web/sites 'developapp' failed with message '{
    "Code": "BadRequest",
    "Message": "HTTP request body must not be empty.",
    "Target": null,
    "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": null
  }'
  At line:1 char:1
  + New-AzureRmResourceGroupDeployment -Name test -ResourceGroupName deve ...
  + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo          : NotSpecified: (:) [New-AzureRmResourceGroupDeployment], Exception
      + FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResourceGroupDeploymentCmdlet</p>
  
  <p>VERBOSE: 13:52:43 - Resource Microsoft.Web/certificates 'testCert' provisioning status is succeeded
  New-AzureRmResourceGroupDeployment : 13:52:43 - Template output evaluation skipped: at least one resource deploym
  ent operation failed. Please list deployment operations for details. Please see <a href="https://aka.ms/arm-debug" rel="nofollow noreferrer">https://aka.ms/arm-debug</a> for usag
  e details.
  At line:1 char:1
  + New-AzureRmResourceGroupDeployment -Name test -ResourceGroupName deve ...
  + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo          : NotSpecified: (:) [New-AzureRmResourceGroupDeployment], Exception
      + FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResourceGroupDeploymentCmdlet</p>
  
  <p>New-AzureRmResourceGroupDeployment : 13:52:43 - Template output evaluation skipped: at least one resource deploym
  ent operation failed. Please list deployment operations for details. Please see <a href="https://aka.ms/arm-debug" rel="nofollow noreferrer">https://aka.ms/arm-debug</a> for usag
  e details.
  At line:1 char:1
  + New-AzureRmResourceGroupDeployment -Name test -ResourceGroupName deve ...
  + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo          : NotSpecified: (:) [New-AzureRmResourceGroupDeployment], Exception
      + FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResourceGroupDeploymentCmdlet</p>
  
  <p>Any of you guys have suggestion on what could be causing this? Thanks in advance!</p>