29
votes

I am trying to open a port in a Windows Azure virtual machine. I have a game listening on that port, and I am able to access it via localhost, so the game is running.

I have also opened the port in the firewall and created an endpoint in the virtual machine, but the port doesn't seem to be open to the outside world. I have tried accessing it both via the IP address and the DNS with the same results.

Is there anything else I should do? I have looked up several tutorials online and can't figure out what I am doing wrong.

8

8 Answers

14
votes

Irina, make sure you have configured your endpoint properly by setting the private and public port. Here's a documentation that explains the steps to accomplish this...

http://www.windowsazure.com/en-us/documentation/articles/virtual-machines-set-up-endpoints/

34
votes

this has changed to this

enter image description here

I would recommend ignoring 100% of what is on google at the moment

6
votes

Microsoft Azure'shell from here

It's easy via Azure CLI, for example , open port 80

$ az vm open-port -g MyResourceGroup -n MyVm --port 80

Open multiple ports at the same time

az vm open-port -g MyResourceGroup -n MyVm --port 80-100 --priority 100

Open all..

az vm open-port -g MyResourceGroup -n MyVm --port '*'

Pay special attention to this parameter,Must be unique for each rule

--priority : Rule priority, between 100 (highest priority) and 4096 (lowest priority). Must be unique for each rule in the collection. Default: 900.

5
votes

For future reference, if you're trying to listen to 3000 or that range it simply does not work.

Go to the 8080's range, make the inbound rule and you're up and running.

4
votes

This is a two step process:

  1. Configure the port rule in the Azure Portal (No need of any restarts. The effect takes place in a few minutes.) Here are the steps (at the time of writing): Click on the VM -> Click on 'Networking' -> Click 'Allow inbound port rule' Add Inbound Port rule

  2. Configure the port rule in the VM's own Firewall - this depends on the Operating System your VM has got (OR disable this firewall) Here are the steps for Windows 10: Open 'Windows Firewall with Advanced Security' Desktop App -> Click on 'Inbound Rules' on the left panel -> Click on 'New Rule' in the Actions panel on the right. The following screenshots explain the rest. Select Port Enter port number Allow the connection Select as applicable Add name and desc

Now the application listening to the port can be reached over the internet.

3
votes

Probably this is the latest solution at a time of writing this answer:

You need to create a Network Security Group (or use an existing one). The easiest way is to search for Network Security Groups in the search resources bar. If there is an existing NSG, click on it and find inbound security rules from the settings. Then add an inbound rule with your desired port.For example, I opened port 8080 on my VM with settings shown in picture below.

More info: https://azure.microsoft.com/en-us/documentation/articles/virtual-machines-windows-nsg-quickstart-portal/

Azure inbound security rule example

3
votes

In addition to described, you may need to create inbound rule in VM firewall. The settings in portal create forwarding from public IP towards VM. VM itself should allow applications to listen on the port. This may explain why this didn't work for Irina on some ports and worked on other ports.

0
votes

Check the Windows firewall on the VM also. If port 8080 is not added in firewall inbound rules, then make sure to add a new inbound rule to allow access to port 8080. (Remotely login to your VM. Windows Defender Firewall -> Advanced Settings)

enter image description here