Hi Naval Rishi,
thank you for posting your question on the Q&A portal and providing those details about your issue with Azure Virtual Machines and WebRTC. It’s definitely frustrating when something works locally but not in the cloud, so let’s try to break this down step by step.
First, since your VM has a public IP and no outbound restrictions in the Network Security Group (NSG), the basics seem correct. But there are a few Azure-specific things that could be blocking STUN traffic. WebRTC relies on STUN servers to discover ICE candidates, and if the VM can’t reach them, it’s often a networking or configuration issue.
One common gotcha is that Azure’s default NSG rules allow outbound traffic, but some ISPs or intermediate firewalls might block UDP ports used by STUN (usually 3478 and 5349). Even though your NSG is open, Azure’s underlying infrastructure or your VM’s local firewall could interfere. You can check the local firewall on the VM to ensure it’s not blocking these ports. Here’s Microsoft’s documentation on NSG rules for reference: Network Security Groups in Azure.
Another thing to test is whether your VM can reach the STUN server at all. Try running a simple UDP connectivity test using tools like nc
(netcat) or Test-NetConnection
in PowerShell. For example, if you’re using stun.l.google.com:19302
, you could check if the VM can send/receive UDP packets to that endpoint. If it fails, it might be a routing issue. Azure sometimes applies platform-level filters, so you might need to explicitly allow UDP traffic in the NSG, even if it seems open.
Also, double-check that the VM’s public IP is properly associated and not stuck in a "middle" state. Sometimes, restarting the VM or reassigning the IP can help. Here’s more info on public IPs in Azure: Public IP addresses in Azure.
Lastly, if you’re using a custom DNS or have modified the VM’s network settings, ensure DNS resolution works for the STUN server’s domain. You can test this with nslookup stun.l.google.com
from the VM.
If none of this helps, could you share the exact error or behavior you’re seeing? For example, does the request time out, or is there a specific error in the browser console? That might give more clues.
Hope this points you in the right direction! Let me know if you hit any snags, and I’ll try to help further.
Best regards,
Alex
P.S. If my answer help to you, please Accept my answer
PPS That is my Answer and not a Comment
https://ctrlaltdel.blog/
Best regards,
Alex
P.S. If my answer help to you, please Accept my answer
PPS That is my Answer and not a Comment
https://ctrlaltdel.blog/