I am trying to develop an ARM template for deployment of multiple webapps, but I am stuck trying to configure the webapp using the settings available in Microsoft.Web/sites/config. Whatever I put in there, the settings are just ignored when I deploy the webapp. I'm basing my template on David Ebbos example.
This is what I am trying at the moment:
// Serverfarm (appservice)
{
"apiVersion": "2015-08-01",
"type": "Microsoft.Web/serverfarms",
"sku": {
"name": "B1",
"tier": "Standard",
"size": "B1",
"family": "B",
"capacity": 1
},
"name": "[variables('appSvcName')]",
"location": "[resourceGroup().location]",
"tags": {
"project": "[[variables('webAppName')]]"
},
"properties": {
"name": "[variables('appSvcName')]",
"numberOfWorkers": 1
}
},
// Site (Webapp)
{
"apiVersion": "2015-08-01",
"type": "Microsoft.Web/sites",
"name": "[variables('webAppName')]",
"location": "[resourceGroup().location]",
"tags": {
"project": "[[variables('webAppName')]]"
},
"dependsOn": [
"[resourceId('Microsoft.Web/serverfarms', variables('appSvcName'))]"
],
"properties": {
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('appSvcName'))]",
"hostNames": [
"[concat(variables('webAppName'), '.azurewebsites.net')]"
],
"enabledHostNames": [
"[concat(variables('webAppName'), '.azurewebsites.net')]",
"[concat(variables('webAppName'), '.scm.azurewebsites.net')]"
],
// TODO : These resources are ignored so far
"resources": [
{
"apiVersion": "2015-08-01",
"name": "web",
"type": "Microsoft.Web/sites/config",
"location": "[resourceGroup().location]",
"dependsOn": [
"[resourceId('Microsoft.Web/Sites', variables('webAppName'))]"
],
"properties": {
"phpVersion": "",
"netFrameworkVersion": "v4.6",
"use32BitWorkerProcess": false, /* 64-bit platform */
"webSocketsEnabled": true,
"alwaysOn": true,
"requestTracingEnabled": true, /* Failed request tracing, aka 'freb' */
"httpLoggingEnabled": true, /* IIS logs (aka Web server logging) */
"logsDirectorySizeLimit": 40, /* 40 MB limit for IIS logs */
"detailedErrorLoggingEnabled": true, /* Detailed error messages */
"remoteDebuggingEnabled": false,
"remoteDebuggingVersion": "VS2015",
"defaultDocuments": [
"default.aspx",
"Default.htm",
"Default.html",
"index.html",
"hostingstart.html"
]
}
},
{
"apiVersion": "2015-08-01",
"name": "connectionstrings",
"type": "Microsoft.Web/sites/config",
"location": "[resourceGroup().location]",
"dependsOn": [
"[resourceId('Microsoft.Web/Sites', variables('webAppName'))]"
],
"properties": {
"umbracoDbDsn": {
"value": "[concat('Data Source=tcp:', reference(concat('Microsoft.Sql/servers/', variables('sqlServerName'))).fullyQualifiedDomainName, ',1433;Initial Catalog=', variables('sqlDbName'), ';User Id=', variables('appSvcName'), '@', variables('sqlServerName'), ';Password=e15cO1PtIR5dtq3zUlwK;')]",
"type": "SQLAzure"
}
}
}
]
}
}
One thing I am a bit confused about is that when I run (Get-AzureRmResourceProvider -ProviderNamespace Microsoft.Web).ResourceTypes
in my azure powershell console there is no sites/config ResourceTypeName available.
What gives? Have the config resourcetype been removed from the template definitions? Am I using the wrong apiVersion? I have tried a number of different combinations, to no avail.
Please see this blog - http://wp.sjkp.dk/arm-templates-set-always-on-and-other-site-properties/
You would need siteConfig object under resource.properties of web/config.
{
"apiVersion": "2015-08-01",
"name": "[parameters('webSiteName')]",
"type": "Microsoft.Web/sites",
"location": "[resourceGroup().location]",
"tags": {
"[concat('hidden-related:', resourceGroup().id, '/providers/Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]": "Resource",
"displayName": "Website"
},
"dependsOn": [
"[concat('Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]"
],
"properties": {
"name": "[parameters('webSiteName')]",
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', parameters('hostingPlanName'))]"
},
"resources": [
{
"apiVersion": "2015-08-01",
"name": "web",
"type": "config",
"dependsOn": [
"[concat('Microsoft.Web/sites/', parameters('webSiteName'))]"
],
"properties": {
"javaVersion": "1.8",
"javaContainer": "TOMCAT",
"javaContainerVersion": "8.0",
"siteConfig": {
"<supported-property>": "<value>",
}
}
}
]
}