ARM Templates set “Always on” and other site properties

25/07/2015

Just a quick reminder to myself.

In order to set the “always on” property on a Azure Web App when provisioned from an ARM template, the resource should look like this
[javascript]
{
"apiVersion": "2015-06-01",
"name": "[parameters(‘siteName’)]",
"type": "Microsoft.Web/Sites",
"location": "[parameters(‘siteLocation’)]",
"dependsOn": [ "[concat(‘Microsoft.Web/serverFarms/’, parameters(‘hostingPlanName’))]" ],
"tags": {
"[concat(‘hidden-related:’, resourceGroup().id, ‘/providers/Microsoft.Web/serverfarms/’, parameters(‘hostingPlanName’))]": "empty"
},
"properties": {
"name": "[parameters(‘siteName’)]",
"serverFarmId": "[parameters(‘hostingPlanName’)]",
"siteConfig": {
"AlwaysOn": true
}
},
"resources": [
{
"apiVersion": "2014-11-01",
"type": "config",
"name": "connectionstrings",
"dependsOn": [ "[concat(‘Microsoft.Web/Sites/’, parameters(‘siteName’))]" ],
"properties": {
"MetadataGovernance": {
"value": "[concat(‘Data Source=tcp:’, reference(concat(‘Microsoft.Sql/servers/’, parameters(‘serverName’))).fullyQualifiedDomainName, ‘,1433;Initial Catalog=’, parameters(‘databaseName’), ‘;User Id=’, parameters(‘administratorLogin’), ‘@’, parameters(‘serverName’), ‘;Password=’, parameters(‘administratorLoginPassword’), ‘;’)]",
"type": 2
}
}
}
]
}
[/javascript]

Note the siteConfig element under the “Microsoft.Web/Sites” resource.

The following is a list of supported site properties (Note, not sure all of them can be set)
[javascript]
"properties": {
"numberOfWorkers": 1,
"defaultDocuments": [
"Default.htm",
"Default.html",
"Default.asp",
"index.htm",
"index.html",
"iisstart.htm",
"default.aspx",
"index.php",
"hostingstart.html"
],
"netFrameworkVersion": "v4.0",
"phpVersion": "5.4",
"pythonVersion": "",
"requestTracingEnabled": false,
"requestTracingExpirationTime": null,
"remoteDebuggingEnabled": false,
"remoteDebuggingVersion": "VS2012",
"httpLoggingEnabled": false,
"logsDirectorySizeLimit": 35,
"detailedErrorLoggingEnabled": false,
"publishingUsername": "$somerandomusername",
"publishingPassword": null,
"appSettings": null,
"metadata": null,
"connectionStrings": null,
"handlerMappings": null,
"documentRoot": null,
"scmType": "None",
"use32BitWorkerProcess": true,
"webSocketsEnabled": false,
"alwaysOn": true,
"javaVersion": null,
"javaContainer": null,
"javaContainerVersion": null,
"managedPipelineMode": 0,
"virtualApplications": [
{
"virtualPath": "/",
"physicalPath": "site\\wwwroot",
"preloadEnabled": true,
"virtualDirectories": null
}
],
"winAuthAdminState": 0,
"winAuthTenantState": 0,
"customAppPoolIdentityAdminState": false,
"customAppPoolIdentityTenantState": false,
"runtimeADUser": null,
"runtimeADUserPassword": null,
"loadBalancing": 1,
"routingRules": [],
"experiments": {
"rampUpRules": []
},
"limits": null,
"autoHealEnabled": false,
"autoHealRules": null,
"tracingOptions": null,
"vnetName": "",
"siteAuthEnabled": false,
"siteAuthSettings": null,
"autoSwapSlotName": null
}
[/javascript]