Skip to content

Instantly share code, notes, and snippets.

@alpersilistre
Created May 11, 2023 06:02
Show Gist options
  • Save alpersilistre/54741b165365a55811ae87498dbd415b to your computer and use it in GitHub Desktop.
Save alpersilistre/54741b165365a55811ae87498dbd415b to your computer and use it in GitHub Desktop.
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"applicationName": {
"type": "string",
"metadata": {
"description": "Name of the application."
}
},
"location": {
"type": "string",
"defaultValue": "[resourceGroup().location]",
"metadata": {
"description": "Azure Region where the resources are created."
}
},
"environment": {
"type": "string",
"metadata": {
"description": "Project environment: dev, qa or prd."
}
},
"serverfarmSku": {
"type": "string",
"defaultValue": "S1",
"allowedValues": [
"B1",
"B2",
"B3",
"S1",
"S2",
"S3",
"P1",
"P2",
"P3",
"P4"
],
"metadata": {
"description": "Describes plan's pricing tier and capacity. Check details at https://azure.microsoft.com/en-us/pricing/details/app-service/"
}
}
},
"variables": {
"webappName": "[concat(parameters('applicationName'), '-', parameters('environment'))]",
"serverFarmName": "[concat(parameters('applicationName'), '-', parameters('environment'))]",
"appInsightsName": "[concat(parameters('applicationName'), '-', parameters('environment'))]"
},
"resources": [
{
"apiVersion": "2018-05-01-preview",
"name": "[variables('appInsightsName')]",
"type": "microsoft.insights/components",
"location": "[parameters('location')]",
"kind": "web",
"properties": {
"Application_Type": "web",
"Flow_Type": "Redfield",
"Request_Source": "AppServiceEnablementCreate",
"RetentionInDays": 90,
"publicNetworkAccessForIngestion": "Enabled",
"publicNetworkAccessForQuery": "Enabled"
}
},
{
"type": "Microsoft.Web/serverfarms",
"apiVersion": "2018-02-01",
"name": "[variables('serverFarmName')]",
"location": "[parameters('location')]",
"dependsOn": [
"[resourceId('microsoft.insights/components', variables('appInsightsName'))]"
],
"sku": {
"name": "[parameters('serverfarmSku')]",
"capacity": 1
},
"properties": {
"name": "[variables('serverFarmName')]",
"perSiteScaling": false,
"reserved": false,
"targetWorkerCount": 0,
"targetWorkerSizeId": 0
}
},
{
"name": "[variables('webappName')]",
"type": "Microsoft.Web/sites",
"apiVersion": "2018-11-01",
"location": "[parameters('location')]",
"kind": "app",
"dependsOn": [
"[resourceId('Microsoft.Web/serverfarms', variables('serverFarmName'))]"
],
"identity": {
"type": "SystemAssigned"
},
"properties": {
"enabled": true,
"name": "[variables('webappName')]",
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('serverFarmName'))]",
"httpsOnly": false,
"clientAffinityEnabled": true,
"siteConfig": {}
},
"resources": [
{
"name": "appsettings",
"type": "config",
"apiVersion": "2018-11-01",
"properties": {
"APPINSIGHTS_INSTRUMENTATIONKEY": "[reference(concat('microsoft.insights/components/', variables('appInsightsName')), '2018-05-01-preview').InstrumentationKey]",
"ApplicationInsightsAgent_EXTENSION_VERSION": "~2"
},
"dependsOn": [
"[resourceId('Microsoft.Web/Sites', variables('webappName'))]"
]
}
]
},
{
"type": "Microsoft.Web/sites/config",
"apiVersion": "2018-11-01",
"name": "[concat(variables('webappName'), '/web')]",
"location": "[parameters('location')]",
"dependsOn": [
"[resourceId('Microsoft.Web/sites', variables('webappName'))]"
],
"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",
"httpLoggingEnabled": false,
"logsDirectorySizeLimit": 35,
"detailedErrorLoggingEnabled": false,
"publishingUsername": "[concat('$', parameters('applicationName'), '-', parameters('environment'))]",
"azureStorageAccounts": {},
"scmType": "None",
"scmSiteAlsoStopped": false,
"use32BitWorkerProcess": true,
"webSocketsEnabled": false,
"alwaysOn": false,
"managedPipelineMode": "Integrated",
"virtualApplications": [
{
"virtualPath": "/",
"physicalPath": "site\\wwwroot",
"preloadEnabled": false
}
],
"loadBalancing": "LeastRequests",
"ipSecurityRestrictions": [
{
"ipAddress": "Any",
"action": "Allow",
"priority": 1,
"name": "Allow all",
"description": "Allow all access"
}
],
"scmIpSecurityRestrictions": [
{
"ipAddress": "Any",
"action": "Allow",
"priority": 1,
"name": "Allow all",
"description": "Allow all access"
}
],
"scmIpSecurityRestrictionsUseMain": false,
"http20Enabled": false,
"minTlsVersion": "1.2",
"ftpsState": "AllAllowed",
"reservedInstanceCount": 0
}
}
],
"outputs": {
"webappName": {
"value": "[variables('webappName')]",
"type": "string"
},
"serverFarmName": {
"value": "[variables('serverFarmName')]",
"type": "string"
},
"managedIdentityId": {
"type": "string",
"value": "[reference(resourceId('Microsoft.Web/sites', variables('webappName')), '2018-11-01', 'Full').identity.principalId]"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment