Share via

Azure http function Timeout while contacting DNS servers

Sean Doherty 50 Reputation points
2025-12-30T05:34:17.2833333+00:00

I have a python Azure storage queue function running on consumption plan accessing a separate Azure HTTP function on a flex consumption plan connected to a vnet. I am regularly seeing errors like the following:

Result: Failure Type: Exception: ClientConnectorDNSError: Cannot connect to host xxx.azurewebsites.net:443 ssl:default [Timeout while contacting DNS servers]

Where xxx.azurewebsites.net is the flex consumption plan Azure function app hosting the HTTP end point.

We have set up retry attempts within the python code, but given the frequency of these errors we see long processing times on our Azure storage queue function.

We are using the default Azure DNS.

Azure Functions
Azure Functions

An Azure service that provides an event-driven serverless compute platform.


2 answers

Sort by: Most helpful
  1. SUNOJ KUMAR YELURU 18,336 Reputation points MVP Volunteer Moderator
    2025-12-30T06:59:47.48+00:00

    Hello @Sean Doherty,

    Thanks for using Q and A forum.

    The error you’re encountering, ClientConnectorDNSError: Cannot connect to host xxx.azurewebsites.net:443 ssl:default [Timeout while contacting DNS servers], typically indicates a DNS resolution issue. This can happen when your Azure Function on the consumption plan is trying to reach the HTTP endpoint hosted on a flex consumption plan that is connected to a VNet. Here are some steps you can take to troubleshoot and potentially resolve the issue:

    1. Check VNet Configuration: Ensure that the VNet configuration allows outbound traffic from your Azure Function to the HTTP endpoint.
    2. DNS Settings: Since you’re using the default Azure DNS, you might want to check if there are any custom DNS settings that could be affecting the resolution. If your HTTP function is deployed in a different region or has specific DNS requirements, consider configuring a private DNS zone.
    3. Connection Pooling: Implement connection pooling and keep-alive settings in your Azure Function to reduce the frequency of DNS lookups and improve connection reuse.

    By following these steps, you should be able to reduce the occurrence of DNS-related errors.


    If the Answer is helpful, please click Accept Answer and Up-Vote 👍, so that this can be beneficial to other community members.

    Was this answer helpful?

    1 person found this answer helpful.

  2. Siddhesh Desai 7,400 Reputation points Microsoft External Staff Moderator
    2025-12-30T07:09:35.3833333+00:00

    Hi @Sean Doherty

    Thank you for reaching out to Microsoft Q&A

    Consumption plan Function cannot reach VNET, as a workaround you will have to try below options to resolve the DNS errors:

    Use Azure Front Door or APIM in front of the Flex Function

    Step 1: Add Private Endpoint to the Flex Function

    Go to Flex Consumption Function App

    Open Networking → Private endpoint connections

    Click + Private endpoint

    Select: Sub‑resource: sites

    VNet: same VNet used for Flex integration

    Subnet: dedicated, empty subnet

    Approve the private endpoint connection

    Step 2: Configure private DNS

    Create Private DNS zone:

    privatelink.azurewebsites.net

    Link it to the Flex Function VNet

    Confirm the Flex app resolves to a private IP inside the VNet

    Step 3: Disable public access on the Flex Function

    Flex Function → Networking

    Set:

    Public network access = Disabled

    Step 4: Create Azure Front Door or APIM

    Azure Front Door (Standard / Premium)

    Create a Front Door profile

    Add the Flex Function as an origin

    Enable Private Link to origin

    Approve the Private Link connection

    Use the Front Door endpoint hostname

    Step 5: Update the Consumption Function

    Replace:

    https://<flex-app>.azurewebsites.net

    With:

    https://<frontdoor-or-apim-endpoint>

    Keep the Flex Function Public and Secure It

    Step 1: Enable public access

    Flex Function → Networking

    Set: Public network access = Enabled

    Step 2: Secure inbound access

    Use one or more of:

    Function keys

    Azure AD authentication

    IP access restrictions (where possible)

    Managed Identity authentication

    Step 3: Do not add a Private Endpoint

    Adding a Private Endpoint while keeping a Consumption caller will cause DNS failures.

    Move the Caller to a Plan That Supports VNet Integration

    Step 1: Move Function to: Premium plan, or Flex Consumption plan

    Step 2: Enable VNet integration on both Functions

    Integrate both Function Apps with the same VNet

    Use a dedicated subnet for each integration

    Step 3: (Optional) Add Private Endpoints

    Add Private Endpoint to the Flex Function

    Ensure Private DNS zone privatelink.azurewebsites.net is linked

    Both apps can now resolve the private endpoint

    Was this answer helpful?


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.