Share via

Cannot connect to a virtual machine in a peered VNET

Hemant 41 Reputation points Microsoft External Staff
2026-03-19T02:50:13.6366667+00:00

creating a website from azure portal and my SQL database is on Azure VM which is considered as on-prem.
User's image

Removed PII

Azure App Service
Azure App Service

Azure App Service is a service used to create and deploy scalable, mission-critical web apps.


Answer accepted by question author
  1. Praneeth Maddali 7,315 Reputation points Microsoft External Staff Moderator
    2026-03-25T22:14:01.8966667+00:00

    HI @Hemant

    Thanks for confirming during the offline discussion that the issue is resolved. The connectivity issue between the Azure Cloud App Service and the on‑premises MS SQL Server was addressed by creating and configuring a Hybrid Connection. The required SQL connection string was then added to the App Service configuration. Connectivity was validated from the App Service runtime using a PowerShell command executed from the Kudu (Debug Console). The validation returned “Connection SUCCESSFUL! The Web App can reach the SQL database”, confirming that the Azure App Service can now successfully connect to the SQL Server.

    Reference :

    https://learn.microsoft.com/en-us/azure/app-service/app-service-hybrid-connections?tabs=windows

    https://learn.microsoft.com/en-us/azure/app-service/configure-common?tabs=cli#configure-connection-strings

    User's image

    If the answer is helpful,  Please do click "Accept the answer” and Yes, this can be beneficial to other community members.

    If you have any other questions, let me know in the "comments" and I would be happy to help you

     

    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Q&A Assist
    2026-03-19T02:50:32.4966667+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    The SQL VM in the peered virtual network must be reachable at the network level and must allow SQL traffic. Use the following checks and configuration steps:

    1. Verify VNet peering state
    • In the Azure portal, open each virtual network and select Peering.
    • Confirm the peering Status is Connected in both directions.
    • If not connected, fix the peering first; otherwise no traffic will pass between VNets.
    1. Check basic VM‑to‑VM connectivity
    • From the web app’s VNet integration subnet (or from a test VM in that VNet), test connectivity to the SQL VM’s private IP:
      • Use tools like TcpPing/PsPing to the SQL port (default 1433) or RDP/SSH port to confirm the VM is reachable.
    • If connectivity fails even though peering is Connected, use Network Watcher:
      • Run Connection Troubleshoot and IP flow verify from the source to the SQL VM to see if an NSG or user‑defined route (UDR) is blocking traffic.
    1. Validate NSG and route configuration
    • On the SQL VM’s subnet and NIC NSGs, ensure there is an Allow VNet Inbound rule and no higher‑priority deny rule blocking traffic from the peered VNet.
    • If using UDRs (for example, to send traffic through an NVA/firewall), temporarily remove or adjust the route and test again. If bypassing the NVA restores connectivity, troubleshoot the NVA configuration.
    1. Check the SQL VM itself
    • On the SQL Server VM:
      • Ensure the SQL service is listening on TCP (default 1433) and that the TCP/IP protocol is enabled.
      • Confirm the Windows firewall allows inbound TCP 1433.
      • If using SQL authentication, verify SQL Server authentication mode is enabled and a SQL login with the correct permissions exists.
    1. DNS and name resolution
    • The nslookup timeout in the screenshot indicates the DNS server at 10.50.50.50 is not responding.
    • Either:
      • Fix connectivity to that DNS server (same VNet/peered VNet, NSG/UDR/firewall rules), or
      • Configure the web app’s VNet integration/subnet to use a DNS server that can resolve the SQL VM’s name, or
      • Connect by the SQL VM’s private IP address instead of FQDN.
    1. Confirm inter‑VNet connectivity end‑to‑end
    • If one Azure VM cannot connect to another, follow this sequence:
      1. Check NIC configuration.
      2. Check NSG and UDR for blocked traffic.
      3. Check VM firewall.
      4. Confirm the SQL service is listening on the expected port.
      5. Validate inter‑VNet connectivity as above.

    Once peering is Connected, NSGs/UDRs/firewalls allow traffic, DNS resolves (or IP is used), and SQL Server is listening with the correct authentication, the web app in one VNet can connect to the SQL VM in the peered VNet.


    References:

    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.