3
votes

My team wants to enable the Application Insights Live Profiler for our Web App using an ARM template. This performance feature of Application Insights is explained at the following link https://docs.microsoft.com/en-us/azure/application-insights/app-insights-profiler. However, I can't find any documentation on how to add the feature using an ARM template. I have tried using the following documentation (https://github.com/CawaMS/EnableProfilerForCompute/blob/master/How%20to%20enable%20Application%20Insights%20Profiler%20on%20Azure%20Compute%20resources.md) as a guide but it is geared towards enabling profiling for a VM and Azure Compute resources as opposed to an App Service.

2
Have you had a look at this answer? stackoverflow.com/questions/37570408/…Ian
Any update?If you feel my answer is useful /helpful.Please mark it as an answer so that other folks could benefit from it.Brando Zhang
While your answer describes how to enable how to enable Application Insights via an ARM template, my question is about enabling the Application Inisights Live Profiler described in the link included in the original question (docs.microsoft.com/en-us/azure/application-insights/…). The live profiler is a recently release feature of Application Inisights.knorman

2 Answers

0
votes

According to your description, if you want to deploy the web app and enable the application Insights, I suggest you could try below arm template(adding the Microsoft.Insights/components resource in the template).

Template.json

{
  "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "hostingPlanName": {
      "type": "string",
      "minLength": 1
    },
    "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 capacity. Check details at https://azure.microsoft.com/en-us/pricing/details/app-service/"
      }
    },
    "skuCapacity": {
      "type": "int",
      "defaultValue": 1,
      "minValue": 1,
      "metadata": {
        "description": "Describes plan's instance count"
      }
    }
  },
  "variables": {
    "webSiteName": "[concat('webSite', uniqueString(resourceGroup().id))]"
  },
  "resources": [
    {
      "apiVersion": "2015-08-01",
      "name": "[parameters('hostingPlanName')]",
      "type": "Microsoft.Web/serverfarms",
      "location": "[resourceGroup().location]",
      "tags": {
        "displayName": "HostingPlan"
      },
      "sku": {
        "name": "[parameters('skuName')]",
        "capacity": "[parameters('skuCapacity')]"
      },
      "properties": {
        "name": "[parameters('hostingPlanName')]"
      }
    },
    {
      "apiVersion": "2015-08-01",
      "name": "[variables('webSiteName')]",
      "type": "Microsoft.Web/sites",
      "location": "[resourceGroup().location]",
      "tags": {
        "[concat('hidden-related:', resourceGroup().id, '/providers/Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]": "Resource",
        "displayName": "Website"
      },
      "dependsOn": [
        "[resourceId('Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]"
      ],
      "properties": {
        "name": "[variables('webSiteName')]",
        "serverFarmId": "[resourceId('Microsoft.Web/serverfarms', parameters('hostingPlanName'))]"
      }
    },
    {
      "apiVersion": "2014-04-01",
      "name": "[variables('webSiteName')]",
      "type": "Microsoft.Insights/components",
      "location": "East US",
      "dependsOn": [
        "[resourceId('Microsoft.Web/sites/', variables('webSiteName'))]"
      ],
      "tags": {
        "[concat('hidden-link:', resourceGroup().id, '/providers/Microsoft.Web/sites/', variables('webSiteName'))]": "Resource",
        "displayName": "AppInsightsComponent"
      },
      "properties": {
        "applicationId": "[variables('webSiteName')]"
      }
    }
  ]
}

Output:

enter image description here

Result(the web app has been already related with the appInsights)

enter image description here

0
votes

I was able to locate a Microsoft representative via email who sent me the following response:

Hi,

We are investigating how to automatically enable the Profiler after 
it’s installed with the AI site extension on an App Services resource; 
Currently there is no workaround for that yet ...

Thanks
-cath