Skip to content

Instantly share code, notes, and snippets.

@anthonychu
Last active November 30, 2017 16:12
Show Gist options
  • Save anthonychu/9ea3aca12df863504aa4 to your computer and use it in GitHub Desktop.
Save anthonychu/9ea3aca12df863504aa4 to your computer and use it in GitHub Desktop.
Azure Resource Manager template demonstrating a few things, http://anthonychu.ca/post/azure-app-service-resource-templates-tips-tricks
{
"$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"environmentName": {
"type": "string"
},
"siteLocation": {
"type": "string",
"allowedValues": [ "West US", "East US" ],
"defaultValue": "West US"
}
},
"variables": {
"appServicePlanName": "[concat('awesomeserviceplan-', parameters('environmentName'))]",
"siteName": "[concat('awesomesite-', parameters('environmentname'))]",
"siteProperties": {
"phpVersion": "5.5",
"netFrameworkVersion": "v4.0",
"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": true,
"remoteDebuggingVersion": "VS2013",
"defaultDocuments": [
"index.html",
"hostingstart.html"
]
}
},
"resources": [
{
"apiVersion": "2015-08-01",
"name": "[variables('appServicePlanName')]",
"type": "Microsoft.Web/serverfarms",
"location": "[parameters('siteLocation')]",
"sku": {
"name": "S1",
"tier": "Standard",
"capacity": 1
},
"properties": {
"name": "[variables('appServicePlanName')]"
}
},
{
"apiVersion": "2015-08-01",
"name": "[variables('siteName')]",
"type": "Microsoft.Web/sites",
"location": "[parameters('siteLocation')]",
"dependsOn": [
"[resourceId('Microsoft.Web/serverfarms', variables('appServicePlanName'))]"
],
"properties": {
"serverFarmId": "[variables('appServicePlanName')]"
},
"resources": [
{
"apiVersion": "2015-08-01",
"name": "web",
"type": "config",
"dependsOn": [
"[resourceId('Microsoft.Web/Sites', variables('siteName'))]"
],
"properties": "[variables('siteProperties')]"
},
{
"apiVersion": "2015-08-01",
"name": "appsettings",
"type": "config",
"dependsOn": [
"[resourceId('Microsoft.Web/Sites', variables('siteName'))]"
],
"properties": {
"AppSettingKey1": "Some value",
"AppSettingKey2": "My second setting",
"AppSettingKey3": "My third setting",
"WEBSITE_TIME_ZONE": "Pacific Standard Time"
}
},
{
"apiVersion": "2015-08-01",
"name": "connectionstrings",
"type": "config",
"dependsOn": [
"[resourceId('Microsoft.Web/Sites', variables('siteName'))]"
],
"properties": {
"ConnString1": {
"value": "My custom connection string",
"type": "Custom"
},
"ConnString2": {
"value": "My SQL connection string",
"type": "SQLAzure"
}
}
},
{
"apiVersion": "2015-08-01",
"name": "slotconfignames",
"type": "config",
"dependsOn": [
"[resourceId('Microsoft.Web/Sites', variables('siteName'))]"
],
"properties": {
"connectionStringNames": [ "ConnString1" ],
"appSettingNames": [ "AppSettingKey1", "AppSettingKey2" ]
}
},
{
"apiVersion": "2015-08-01",
"name": "Staging",
"type": "slots",
"location": "[parameters('siteLocation')]",
"dependsOn": [
"[resourceId('Microsoft.Web/Sites', variables('siteName'))]"
],
"properties": { },
"resources": [
{
"apiVersion": "2015-08-01",
"name": "web",
"type": "config",
"dependsOn": [
"[resourceId('Microsoft.Web/Sites/Slots', variables('siteName'), 'Staging')]"
],
"properties": "[variables('siteProperties')]"
},
{
"apiVersion": "2015-08-01",
"name": "appsettings",
"type": "config",
"dependsOn": [
"[resourceId('Microsoft.Web/Sites/Slots', variables('siteName'), 'Staging')]"
],
"properties": {
"AppSettingKey1": "Some staging value",
"AppSettingKey2": "My second staging setting",
"AppSettingKey3": "My third staging setting",
"WEBSITE_TIME_ZONE": "Pacific Standard Time"
}
},
{
"apiVersion": "2015-08-01",
"name": "connectionstrings",
"type": "config",
"dependsOn": [
"[resourceId('Microsoft.Web/Sites/Slots', variables('siteName'), 'Staging')]"
],
"properties": {
"ConnString1": {
"value": "My custom connection string",
"type": "Custom"
},
"ConnString2": {
"value": "My SQL connection string",
"type": "SQLAzure"
}
}
}
]
}
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment