{ "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "metadata": { "_generator": { "name": "bicep", "version": "0.5.6.12127", "templateHash": "7994095741658364045" } }, "parameters": { "skuName": { "type": "string", "defaultValue": "F1", "allowedValues": [ "F1", "D1", "B1", "B2", "B3", "S1", "S2", "S3", "P1", "P2", "P3", "P4" ], "metadata": { "description": "Describes plan's pricing tier and instance size. Check details at https://azure.microsoft.com/en-us/pricing/details/app-service/" } }, "skuCapacity": { "type": "int", "defaultValue": 1, "maxValue": 3, "minValue": 1, "metadata": { "description": "Describes plan's instance count" } }, "sqlAdministratorLogin": { "type": "string", "metadata": { "description": "The admin user of the SQL Server" } }, "sqlAdministratorLoginPassword": { "type": "secureString", "metadata": { "description": "The password of the admin user of the SQL Server" } }, "location": { "type": "string", "defaultValue": "[resourceGroup().location]", "metadata": { "description": "Location for all resources." } } }, "variables": { "hostingPlanName": "[format('hostingplan{0}', uniqueString(resourceGroup().id))]", "websiteName": "[format('website{0}', uniqueString(resourceGroup().id))]", "sqlserverName": "[format('sqlServer{0}', uniqueString(resourceGroup().id))]", "databaseName": "sampledb" }, "resources": [ { "type": "Microsoft.Sql/servers", "apiVersion": "2021-02-01-preview", "name": "[variables('sqlserverName')]", "location": "[parameters('location')]", "tags": { "displayName": "SQL Server" }, "properties": { "administratorLogin": "[parameters('sqlAdministratorLogin')]", "administratorLoginPassword": "[parameters('sqlAdministratorLoginPassword')]", "version": "12.0" } }, { "type": "Microsoft.Sql/servers/databases", "apiVersion": "2021-02-01-preview", "name": "[format('{0}/{1}', variables('sqlserverName'), variables('databaseName'))]", "location": "[parameters('location')]", "tags": { "displayName": "Database" }, "sku": { "name": "Basic" }, "properties": { "collation": "SQL_Latin1_General_CP1_CI_AS", "maxSizeBytes": 1073741824 }, "dependsOn": [ "[resourceId('Microsoft.Sql/servers', variables('sqlserverName'))]" ] }, { "type": "Microsoft.Sql/servers/firewallRules", "apiVersion": "2021-02-01-preview", "name": "[format('{0}/{1}', variables('sqlserverName'), 'AllowAllWindowsAzureIps')]", "properties": { "endIpAddress": "0.0.0.0", "startIpAddress": "0.0.0.0" }, "dependsOn": [ "[resourceId('Microsoft.Sql/servers', variables('sqlserverName'))]" ] }, { "type": "Microsoft.Web/serverfarms", "apiVersion": "2020-12-01", "name": "[variables('hostingPlanName')]", "location": "[parameters('location')]", "tags": { "displayName": "HostingPlan" }, "sku": { "name": "[parameters('skuName')]", "capacity": "[parameters('skuCapacity')]" } }, { "type": "Microsoft.Web/sites", "apiVersion": "2020-12-01", "name": "[variables('websiteName')]", "location": "[parameters('location')]", "tags": { "[format('hidden-related:{0}', resourceId('Microsoft.Web/serverfarms', variables('hostingPlanName')))]": "empty", "displayName": "Website" }, "properties": { "serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('hostingPlanName'))]" }, "dependsOn": [ "[resourceId('Microsoft.Web/serverfarms', variables('hostingPlanName'))]" ] }, { "type": "Microsoft.Web/sites/config", "apiVersion": "2020-12-01", "name": "[format('{0}/{1}', variables('websiteName'), 'connectionstrings')]", "properties": { "DefaultConnection": { "value": "[format('Data Source=tcp:{0},1433;Initial Catalog={1};User Id={2}@{3};Password={4};', reference(resourceId('Microsoft.Sql/servers', variables('sqlserverName'))).fullyQualifiedDomainName, variables('databaseName'), parameters('sqlAdministratorLogin'), reference(resourceId('Microsoft.Sql/servers', variables('sqlserverName'))).fullyQualifiedDomainName, parameters('sqlAdministratorLoginPassword'))]", "type": "SQLAzure" } }, "dependsOn": [ "[resourceId('Microsoft.Sql/servers', variables('sqlserverName'))]", "[resourceId('Microsoft.Web/sites', variables('websiteName'))]" ] }, { "type": "Microsoft.Insights/components", "apiVersion": "2020-02-02", "name": "[format('AppInsights{0}', variables('websiteName'))]", "location": "[parameters('location')]", "tags": { "[format('hidden-link:{0}', resourceId('Microsoft.Web/sites', variables('websiteName')))]": "Resource", "displayName": "AppInsightsComponent" }, "kind": "web", "properties": { "Application_Type": "web" }, "dependsOn": [ "[resourceId('Microsoft.Web/sites', variables('websiteName'))]" ] } ] }