Every new virtual machine created through the Azure wizard is associated with a Network Security Group (NSG). An NSG acts as a stateful firewall – if no rule explicitly allows traffic, Azure blocks it by default.
In this step, you’ll open port 22 for SSH and port 8080 so that a web application running on the VM is reachable from your IP for testing. Substitute a different port if required by your workload, or a different IP range if you’d like broader accessibility.
In the Azure Portal, open the newly-created VM resource and select Networking → Network settings from the left-hand menu.
Select the Network security group.
Select Create Port Rule, then choose Inbound port rule from the drop-down menu.
Fill in the form with My IP address as the source and 22 as the destination port:
Create Port Rule form
Select Add.
To open port 8080, repeat steps 3-5 and enter 8080 as the destination port.
You have now opened ports 22 and 8080 to your IP. In the next step, you’ll verify connectivity from your local machine.