Azure function logs not going to App insight

Abhay Gupta 71 Reputation points
2021-07-20T15:37:18.447+00:00

Hi

Recently our azure python based azure function has stopped logging anything to application insight. We are not sure what went wrong. There are no errors logged anywhere. I can see the logs through the kudu but nothing in app insights.

Our function app is in vnet with private endpoint.

Also, does app insight needs to have workspace mode. Seems like in classic mode nothing gets logged.

Thanks

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

Accepted answer
  1. Pramod Valavala 20,591 Reputation points Microsoft Employee
    2021-07-29T05:20:42.46+00:00

    @Abhay Gupta Since your function app is inside a VNET, it is possible that you have the VNET_ROUTE_ALL app setting set to 1 forcing all traffic via the VNET.

    If the VNET doesn't have an outbound rule for the AzureMonitor Service Tag, application insight requests won't get through.

    0 comments No comments

3 additional answers

Sort by: Most helpful
  1. Jaliya Udagedara 2,731 Reputation points MVP
    2021-07-21T07:32:39.453+00:00

    Workspace-based Application Insights is now the preferred resource for sending telemetry, and Classic Application Insights is going to get retired on 29 Feb 2024. Saying that technically Classic Application Insights should continue to work as it at least up until 29 Feb 2024.

    Since this is broken for some reason, I would personally suggest creating a Workspace-based Application Insights and use that for your logging. Check whether it works, if it is, we will have to investigate what broke Classic Application Insights, ideally through an Azure Support Ticket. If it still doesn't work, then something must have changed in the configuration.

    Hope this makes sense!


  2. Abhay Gupta 71 Reputation points
    2021-08-14T13:06:32.143+00:00

    Thanks @Pramod Valavala and @Jaliya Udagedara

    There was firewall issue on the vnet routing.


  3. Udaybhanu Karmakar 1 Reputation point
    2022-07-30T16:20:39.76+00:00

    We had the same issue. Our Azure Function had a private endpoint and integrated with VNET, where all outbound calls were getting routed through the VNET. The specific Subnet under the VNET had a route table associated, which was routing all calls through a third-party firewall.

    Here is how it was fixed for us:

    1. Download the latest Azure IP Ranges and Service Tags – Public Cloud list - https://www.microsoft.com/en-us/download/confirmation.aspx?id=56519
    2. Look for Azure Monitor IP ranges, either select the whole range or the range for specific region(s) of your resource, from the above list.
    3. Allow outbound access in your firewall to the Azure Monitor IP ranges from the (outbound) subnet where your Azure Function is integrated.

    Hope this helps.

    0 comments No comments