From fde03e1d8f64e1bbfa5e910426df0eed0cb24354 Mon Sep 17 00:00:00 2001 From: Marcus Felling Date: Mon, 14 Dec 2020 17:19:37 -0600 Subject: [PATCH] Add web-app-linux example (#1148) * Add dev container for codespaces * Add example for web-app-linux * Remove devcontainer after reading discussion in https://github.com/Azure/bicep/pull/455 * Add web-app-linux to index * format main.bicep * Trigger new workflow run. Nerdbank git versioning stuck process. * Add line at end of file --- docs/examples/101/web-app-linux/main.bicep | 31 ++++++++++++ docs/examples/101/web-app-linux/main.json | 58 ++++++++++++++++++++++ docs/examples/index.json | 4 ++ 3 files changed, 93 insertions(+) create mode 100644 docs/examples/101/web-app-linux/main.bicep create mode 100644 docs/examples/101/web-app-linux/main.json diff --git a/docs/examples/101/web-app-linux/main.bicep b/docs/examples/101/web-app-linux/main.bicep new file mode 100644 index 00000000000..8b8541cc180 --- /dev/null +++ b/docs/examples/101/web-app-linux/main.bicep @@ -0,0 +1,31 @@ +param webAppName string = uniqueString(resourceGroup().id) // Generate unique String for web app name +param sku string = 'S1' // The SKU of App Service Plan +param linuxFxVersion string = 'php|7.4' // The runtime stack of web app +param location string = resourceGroup().location // Location for all resources + +var appServicePlanName = toLower('AppServicePlan-${webAppName}') +var webSiteName = toLower('wapp-${webAppName}') + +resource appServicePlan 'Microsoft.Web/serverfarms@2020-06-01' = { + name: appServicePlanName + location: location + sku: { + name: sku + } + kind: 'linux' + properties: { + reserved: true + } +} + +resource appService 'Microsoft.Web/sites@2020-06-01' = { + name: webSiteName + location: location + kind: 'app' + properties: { + serverFarmId: appServicePlan.id + siteConfig: { + linuxFxVersion: linuxFxVersion + } + } +} diff --git a/docs/examples/101/web-app-linux/main.json b/docs/examples/101/web-app-linux/main.json new file mode 100644 index 00000000000..feefbfb52ed --- /dev/null +++ b/docs/examples/101/web-app-linux/main.json @@ -0,0 +1,58 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "webAppName": { + "type": "string", + "defaultValue": "[uniqueString(resourceGroup().id)]" + }, + "sku": { + "type": "string", + "defaultValue": "S1" + }, + "linuxFxVersion": { + "type": "string", + "defaultValue": "php|7.4" + }, + "location": { + "type": "string", + "defaultValue": "[resourceGroup().location]" + } + }, + "functions": [], + "variables": { + "appServicePlanName": "[toLower(format('AppServicePlan-{0}', parameters('webAppName')))]", + "webSiteName": "[toLower(format('wapp-{0}', parameters('webAppName')))]" + }, + "resources": [ + { + "type": "Microsoft.Web/serverfarms", + "apiVersion": "2020-06-01", + "name": "[variables('appServicePlanName')]", + "location": "[parameters('location')]", + "sku": { + "name": "[parameters('sku')]" + }, + "kind": "linux", + "properties": { + "reserved": true + } + }, + { + "type": "Microsoft.Web/sites", + "apiVersion": "2020-06-01", + "name": "[variables('webSiteName')]", + "location": "[parameters('location')]", + "kind": "app", + "properties": { + "serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('appServicePlanName'))]", + "siteConfig": { + "linuxFxVersion": "[parameters('linuxFxVersion')]" + } + }, + "dependsOn": [ + "[resourceId('Microsoft.Web/serverfarms', variables('appServicePlanName'))]" + ] + } + ] +} \ No newline at end of file diff --git a/docs/examples/index.json b/docs/examples/index.json index b8638aa6865..a7cb12113a9 100644 --- a/docs/examples/index.json +++ b/docs/examples/index.json @@ -191,6 +191,10 @@ "filePath": "101/vnet-two-subnets/main.bicep", "description": "101/vnet-two-subnets" }, + { + "filePath": "101/web-app-linux/main.bicep", + "description": "101/web-app-linux" + }, { "filePath": "101/web-app-windows/main.bicep", "description": "101/web-app-windows"