Windows server on Azure VM unable to contact external third party tcp port 443 provider but after running network diagnostic on Azure portal it works

Will 0 Reputation points
2026-12-01T01:54:32.7966667+00:00

I have a VM on Azure running Windows Server 2022 Datacenter Azure Edition initially we tried to run a service which requires external tcp connection to port 443 it fails to connect. But whenever I ran the Network Diagonostic in Azure Portal for that server the result is success and the port opens up for some duration of time and I am able to connect. After a while the port is closed again...I need help please. Its been bugging me for days. Thanks in advance!

Azure Virtual Machines
Azure Virtual Machines

An Azure service that is used to provision Windows and Linux virtual machines.

0 comments No comments

1 answer

Sort by: Newest
  1. Sedat SALMAN 14,705 Reputation points MVP
    2026-12-01T05:10:59.99+00:00

    Hi Will,

    The Network Watcher test doesn't change anything on the VM or the NSG. Connection troubleshoot is agentless now and only sends test probes, so things working right after you run it is very likely timing, not cause. That leaves two usual suspects.

    1. How the VM gets out to the internet. If the VM has no public IP, NAT gateway or load balancer outbound rule, it's using default outbound access. That IP belongs to Microsoft and can change without notice, so if the provider allowlists your source IP, connections will work some of the time and fail the rest. Check which IP you leave from when it works and when it fails:

    Invoke-RestMethod https://api.ipify.org
    

    2. Idle connections being dropped. If the service keeps one long-lived TLS connection open and it goes quiet, the outbound flow is removed after 4 minutes idle. The app still thinks it's connected, but packets go nowhere until it reconnects. TCP keepalives shorter than 4 minutes, or an app-level heartbeat, fix this.

    To tell them apart, run this and note when it starts failing:

    while ($true) {
      "{0}  {1}" -f (Get-Date -Format T), (Test-NetConnection provider.example.com -Port 443 -WarningAction SilentlyContinue).TcpTestSucceeded
      Start-Sleep 30
    }
    

    If new connections fail too, check Effective routes on the NIC. A 0.0.0.0/0 route to a firewall or NVA means that device is the one dropping traffic.

    Either way, the clean fix is an explicit outbound method: a NAT gateway on the subnet, or a Standard public IP on the VM. You get a static outbound IP to give the provider, and default outbound access is being retired anyway.

    References:

    Was this answer helpful?

    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.