Azure Function not running after enabling application insights

Puffles 0 Reputation points
2025-12-17T14:58:45.49+00:00

Hi,

I have a function setup. Hierarchy looks fine. And it appears under app files. I was able to run it previously but as soon as I set up Application insights, I am unable to run it. In overview tab, I can see

User's image

In app files I can see my code

User's image

Since I already had the link to my function, I could open it via that link. But when I open it , it gives me this errorUser's image

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Rakesh Mishra 4,110 Reputation points Microsoft External Staff Moderator
    2025-12-17T15:35:34.6666667+00:00

    Hey @Puffles ! It sounds like you're having some trouble with your Azure Function after enabling Application Insights. Here are a few things you can check and try to resolve this issue:

    1. Check Application Insights Configuration:
      • Go to your function app in the Azure portal and navigate to Configuration. Ensure you have the APPLICATIONINSIGHTS_CONNECTION_STRING set up correctly. If you see the APPINSIGHTS_INSTRUMENTATIONKEY, consider replacing it with the connection string, as the instrumentation key will be deprecated by 2025.
    2. Review Logs for Errors:
      • Use the Application Insights logs to look for any errors. You can run a query like:
        
             exceptions
        
             | where customDimensions.Category == "Host.Startup"
        
        
      This will help you find errors related to the startup failure of your function.
    3. Check Sampling Settings:
      • Sometimes, Application Insights has a sampling feature enabled, which may lead to missing logs. To check or adjust the sampling settings, review your function app's host.json file:
        
             {
        
               "logging": {
        
                 "applicationInsights": {
        
                   "samplingSettings": {
        
                     "isEnabled": true,
        
                     "maxTelemetryItemsPerSecond": 20,
        
                     "excludedTypes": "Request;Exception"
        
                   }
        
                 }
        
               }
        
             }
        
        
    4. Diagnose Function App Configuration:
      • Use the Diagnose and solve problems blade in the Azure portal to run Function Configuration Checks. Make sure that the settings in place for Application Insights are accurate and not overlapping.
    5. Look for Function Errors or Missing Invocation:
      • Check to see if the function is indeed being triggered. You can use queries to verify that this is happening, like this:
        
             traces
        
             | where message contains "Exception while executing function"
        
        
    6. Check for Other Potential Issues:
      • It's possible that the function runtime may not be starting up due to some underlying exceptions or conflicts with other apps pulling from the same queue.

    If you've gone through these steps and are still facing issues, it might be helpful to provide more specific details about any error messages you are encountering or the exact configuration you applied when setting up Application Insights.

    Hope this helps! Let me know if you have any further questions or need more assistance!

    References:

    Note: This content was drafted with the help of an AI system.

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.