Skip to content

Commit

Permalink
Merge pull request Azure#8002 from JFolberth/appserviceInsights
Browse files Browse the repository at this point in the history
Appservice insights
  • Loading branch information
bmoore-msft authored Sep 9, 2020
2 parents ff936bf + 5cc4005 commit ee18f49
Show file tree
Hide file tree
Showing 4 changed files with 210 additions and 0 deletions.
21 changes: 21 additions & 0 deletions 201-web-app-loganalytics/README.md
Original file line number Diff line number Diff line change
@@ -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`


174 changes: 174 additions & 0 deletions 201-web-app-loganalytics/azuredeploy.json
Original file line number Diff line number Diff line change
@@ -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
}
}
}
]
}
6 changes: 6 additions & 0 deletions 201-web-app-loganalytics/azuredeploy.parameters.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
}
}
9 changes: 9 additions & 0 deletions 201-web-app-loganalytics/metadata.json
Original file line number Diff line number Diff line change
@@ -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"
}

0 comments on commit ee18f49

Please sign in to comment.