locked
Would Application Insights work with Application Type ASP.NET RRS feed

  • Question

  • Hi,

    I'm trying to use the same Application Insights instance I use for my Azure API App (App Service). My Application Insight's Application Type is set to ASP.NET. Would this type work for with Azure Functions? It seems it doesn't. 

    Is it possible to use the same Application Insights instance between Azure Functions App and API App ? 

    Thanks

    Thursday, February 22, 2018 2:33 PM

All replies

  • Yeah, that ASP.NET kind basically just affects the UI layout for your App Insights and some of the out of the box detectors they have. The data store is 100% the same and you can write queries that work against both. You might find some weird things where Azure Functions and ASP.NET's App Insights integration emits data slightly differently, but there shouldn't be anything too bizarre.
    Thursday, February 22, 2018 9:06 PM
  • So the answer is actually "no you cannot". 

    Application Insights absolutely can be used with an Azure Functions App and if you are out of testing phase or simply want more data then you most definitely should use it. There are 2 different ways to enable it depending on if you have an existing Function App that you are wanting to add Application Insights too or if you are creating a new Functions App.

    For an Existing Function App:

    • Create a new Application Insights in your Resource Group or in a Resource Group of it's own or in some other existing Resource group (doesn't actually matter), and set the type to "General".
    • Then copy the "Instrumentation Key" from "Overview>Essentials" blade.
    • Next go to your function app and in "Application Settings" and click "+ Add new setting"; Paste the key in as the value; and for the name "APPINSIGHTS_INSTRUMENTATIONKEY".
    • On the same page just above, delete the Application Setting named "AzureWebJobsDashboard".
    • Now in your Function app click on the Application Insights on the Overview tab under Configured Features and enjoy.

    For a NEW Function App:

    • You simply flip the switch to on when you are creating it and it handles all Instrumentation Key stuff and the deletion of the WebJobsDashboard for you and just works.

    FYI when you go to configure the metrics  in Metrics Explorer; All the Azure Functions metrics are under the "Custom" selection. 

    Here are the reference articles if you want a nice walk through with pictures and all of what I gave you above.

    Monitor Azure Functions:

    https://docs.microsoft.com/en-us/azure/azure-functions/functions-monitoring

    If you want to know about the built-in logging go here:

    https://docs.microsoft.com/en-us/azure/azure-functions/functions-monitoring#logging-to-storage

    And if you want to read up on how to manage your function app, like why we deleted the dashboard and such the read here:

    https://docs.microsoft.com/en-us/azure/azure-functions/functions-how-to-use-azure-function-app-settings#settings

    Hope that helps, please mark as answered.

    ~Theo




    Friday, February 23, 2018 4:22 AM
  • As far as I understood if I want to use Application Insights with Azure Functions, application type has to be "GENERAL". 

    So then my question would be, can I use the same application type "GENERAL" for using Application Insights for an API App (ASP.NET Core WebAPI) ? 

    I saw that it's possible to write join queries that span across multiple Application Insights instances but it would be more convenient if I can use the same instance for both Apps. 

    https://azure.microsoft.com/en-us/blog/query-across-resources/

    Friday, February 23, 2018 7:45 AM
  • Yes that is possible, you would just use the "Instrumentation Key" in the Application Setting "APPINSIGHTS_INSTRUMENTATIONKEY" and you would get your desired result.

    Hope that answers the query, mark as answered if so.

    ~Theo

    Friday, February 23, 2018 2:06 PM