diff --git a/201-web-app-loganalytics/README.md b/201-web-app-loganalytics/README.md new file mode 100644 index 000000000000..9023c137cc8f --- /dev/null +++ b/201-web-app-loganalytics/README.md @@ -0,0 +1,21 @@ +# Web App with Application Insights sending to Log Analytics + +![Azure Public Test Date](https://azurequickstartsservice.blob.core.windows.net/badges/201-web-app-loganalytics/PublicLastTestDate.svg) +![Azure Public Test Result](https://azurequickstartsservice.blob.core.windows.net/badges/201-web-app-loganalytics/PublicDeployment.svg) + +![Azure US Gov Last Test Date](https://azurequickstartsservice.blob.core.windows.net/badges/201-web-app-loganalytics/FairfaxLastTestDate.svg) +![Azure US Gov Last Test Result](https://azurequickstartsservice.blob.core.windows.net/badges/201-web-app-loganalytics/FairfaxDeployment.svg) + +![Best Practice Check](https://azurequickstartsservice.blob.core.windows.net/badges/201-web-app-loganalytics/BestPracticeResult.svg) +![Cred Scan Check](https://azurequickstartsservice.blob.core.windows.net/badges/201-web-app-loganalytics/CredScanResult.svg) + +[![Deploy To Azure](https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/1-CONTRIBUTION-GUIDE/images/deploytoazure.svg?sanitize=true)](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Fazure-quickstart-templates%2Fmaster%2F201-web-app-loganalytics%2Fazuredeploy.json) +[![Deploy To Azure US Gov](https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/1-CONTRIBUTION-GUIDE/images/deploytoazuregov.svg?sanitize=true)](https://portal.azure.us/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Fazure-quickstart-templates%2Fmaster%2F201-web-app-loganalytics%2Fazuredeploy.json) +[![Visualize](https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/1-CONTRIBUTION-GUIDE/images/visualizebutton.svg?sanitize=true)](http://armviz.io/#/?load=https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Fazure-quickstart-templates%2Fmaster%2F201-web-app-loganalytics%2Fazuredeploy.json) + +This template will is to help support the new API versions of microsoft.insights/components. Starting with 2020-02-02-preview an [Workspace Resource ID](https://docs.microsoft.com/en-us/azure/templates/microsoft.insights/2020-02-02-preview/components) will be required. +This template will deploy the App Service Plan, App Service, Application Insights, Log Analytics Workspace and hook it all together. + +`Tags: Azure, App Service Plan, App Service, Log Analytics, Application Insights` + + diff --git a/201-web-app-loganalytics/azuredeploy.json b/201-web-app-loganalytics/azuredeploy.json new file mode 100644 index 000000000000..beb60534feb5 --- /dev/null +++ b/201-web-app-loganalytics/azuredeploy.json @@ -0,0 +1,174 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "skuName": { + "type": "string", + "defaultValue": "S1", + "metadata": { + "description": "Which Pricing tier our App Service Plan to" + } + }, + "skuCapacity": { + "type": "int", + "defaultValue": 1, + "metadata": { + "description": "How many instances of our app service will be scaled out to" + } + + }, + "location": { + "type": "string", + "defaultValue": "[resourceGroup().location]", + "metadata": { + "description": "Location for all resources." + } + }, + "appName": { + "type": "string", + "defaultValue": "[uniqueString(resourceGroup().id)]" + } + }, + "variables": { + "appServicePlanName": "[toLower(concat('asp-', parameters('appName')))]", + "webSiteName": "[toLower(concat('wapp-', parameters('appName')))]", + "appInsightName": "[toLower(concat('appi-',parameters('appName')))]", + "logAnalyticsName": "[toLower(concat('la-',parameters('appName')))]" + }, + "resources": [ + { + "type": "Microsoft.Web/serverfarms", + "apiVersion": "2019-08-01", + "name": "[variables('appServicePlanName')]", + "location": "[parameters('location')]", + "sku": { + "name": "[parameters('skuName')]", + "capacity": "[parameters('skuCapacity')]" + }, + "tags": { + "displayName": "HostingPlan", + "ProjectName": "[parameters('appName')]" + }, + "properties": { + "name": "[variables('appServicePlanName')]" + } + }, + { + "type": "Microsoft.Web/sites", + "apiVersion": "2019-08-01", + "name": "[variables('webSiteName')]", + "location": "[parameters('location')]", + "identity": { + "type": "SystemAssigned" + }, + "dependsOn": [ + "[resourceId('Microsoft.Web/serverfarms/', variables('appServicePlanName'))]", + "[resourceId('Microsoft.OperationalInsights/workspaces',variables('logAnalyticsName'))]" + ], + "tags": { + "displayName": "Website", + "ProjectName": "[parameters('appName')]" + }, + "properties": { + "serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('appServicePlanName'))]", + "httpsOnly": true, + "siteConfig": { + "minTlsVersion": "1.2" + } + }, + "resources": [ + { + "type": "config", + "apiVersion": "2019-08-01", + "name": "appsettings", + "dependsOn": [ + "[resourceId('Microsoft.Web/Sites', variables('WebsiteName'))]", + "Microsoft.ApplicationInsights.AzureWebSites", + "[resourceId('microsoft.insights/components', variables('appInsightName'))]" + + ], + "properties": { + "APPINSIGHTS_INSTRUMENTATIONKEY": "[reference(resourceId('microsoft.insights/components',variables('appInsightName'))).InstrumentationKey]" + } + }, + { + "type": "siteextensions", + "apiVersion": "2019-08-01", + "name": "Microsoft.ApplicationInsights.AzureWebSites", + "dependsOn": [ + "[resourceId('Microsoft.Web/Sites', variables('WebsiteName'))]", + "[resourceId('microsoft.insights/components', variables('appInsightName'))]" + ] + }, + { + "type": "config", + "apiVersion": "2019-08-01", + "name": "logs", + "dependsOn": [ + "[resourceId('Microsoft.Web/Sites', variables('WebsiteName'))]" + ], + "properties": { + "applicationLogs": { + "fileSystem": { + "level": "Warning" + } + }, + "httpLogs": { + "fileSystem": { + "retentionInMb": 40, + "enabled": true + } + }, + "failedRequestsTracing": { + "enabled": true + }, + "detailedErrorMessages": { + "enabled": true + } + } + } + ] + }, + { + "type": "microsoft.insights/components", + "apiVersion": "2020-02-02-preview", + "name": "[variables('appInsightName')]", + "location": "[parameters('location')]", + "kind": "string", + "dependsOn": [ + "[resourceId('Microsoft.Web/Sites', variables('WebsiteName'))]", + "[resourceId('Microsoft.OperationalInsights/workspaces', variables('logAnalyticsName'))]" + ], + "tags": { + "displayName": "AppInsight", + "ProjectName": "[parameters('appName')]" + }, + "properties": { + "Application_Type": "web", + "applicationId": "[variables('appInsightName')]", + "WorkspaceResourceId": "[resourceId('Microsoft.OperationalInsights/workspaces', variables('logAnalyticsName'))]" + } + }, + { + "type": "Microsoft.OperationalInsights/workspaces", + "apiVersion": "2020-03-01-preview", + "name": "[variables('logAnalyticsName')]", + "location": "[parameters('location')]", + "tags": { + "displayName": "Log Analytics", + "ProjectName": "[parameters('appName')]" + }, + "properties": { + "sku": { + "name": "pergb2018" + }, + "retentionInDays": 120, + "features": { + "searchVersion": 1, + "legacy": 0, + "enableLogAccessUsingOnlyResourcePermissions": true + } + } + } + ] +} diff --git a/201-web-app-loganalytics/azuredeploy.parameters.json b/201-web-app-loganalytics/azuredeploy.parameters.json new file mode 100644 index 000000000000..9c313f06f698 --- /dev/null +++ b/201-web-app-loganalytics/azuredeploy.parameters.json @@ -0,0 +1,6 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", + "contentVersion": "1.0.0.0", + "parameters": { + } +} \ No newline at end of file diff --git a/201-web-app-loganalytics/metadata.json b/201-web-app-loganalytics/metadata.json new file mode 100644 index 000000000000..e1bb83650a53 --- /dev/null +++ b/201-web-app-loganalytics/metadata.json @@ -0,0 +1,9 @@ +{ + "$schema": "https://aka.ms/azure-quickstart-templates-metadata-schema#", + "type": "QuickStart", + "itemDisplayName": "Web App w/ Application Insights sending to Log Analytics", + "description": "This template will is to help support the new API versions of microsoft.insights/components. Starting with 2020-02-02-preview WorkspaceID will be required when creating Application Inisghts.This template will deploy the App Service Plan, App Service, Application Insights, Log Analytics Workspace and hook it all together.", + "summary": "Create a Web App with Application Insights sending to Log Analytics", + "githubUsername": "JFolberth", + "dateUpdated": "2020-08-20" +}