If use the template that you mentioned, I also can repro the issue. If add the following code in the properties,it can create hostingEnvironment successfully. Please have a try with the following code
"virtualNetwork": {
"Id": "[resourceId('Microsoft.Network/virtualNetworks', variables('vnet').name)]",
"Subnet": "[variables('vnet').subnet.name]"
},
The following is the whole code of the HostingEnvironment
{
"apiVersion": "2016-09-01",
"name": "[variables('hostingEnvironment').name]",
"type": "Microsoft.Web/hostingEnvironments",
"location": "[variables('location')]",
"dependsOn": [
],
"properties": {
"Name": "[variables('hostingEnvironment').name]",
"ipSslAddressCount": "[variables('hostingEnvironment').ipSslAddressCount]",
"workerPools": [
{
"workerSizeId": 0,
"workerSize": "medium",
"workerCount": 1
}
],
"virtualNetwork": {
"Id": "[resourceId('Microsoft.Network/virtualNetworks', variables('vnet').name)]",
"Subnet": "[variables('vnet').subnet.name]"
},
"location": "[variables('location')]",
"MultiSize": "medium",
"MultiRoleCount": "1",
"VNETName": "[variables('vnet').name]",
"VNetResourceGroupName": "[resourceGroup().name]",
"VNETSubnetName": "[variables('vnet').subnet.name]"
}
}
Check from the Azure portal.