I have a Debian 6.x box that I needed to move to Azure. Before moving it up, I did make sure that SSH is listening on any port, so is Apache. My NSG has all of the right ports opened (22, 443 for now). I uploaded the VHD, then used the following PowerShell commands to create the VM based off of the VHD:
$vnet = get-AzureRmVirtualNetwork -Name $VnetName -ResourceGroupName $VnetRG $subnet = Get-AzureRmVirtualNetworkSubnetConfig -Name "$SubnetName" -VirtualNetwork $vnet $pip = Get-AzureRmPublicIpAddress -Name "$pipName" -ResourceGroupName $resourceGroupName $NSG = Get-AzureRmNetworkSecurityGroup -Name "$NSGName" -ResourceGroupName $resourceGroupName $nic = New-AzureRmNetworkInterface -ResourceGroupName $resourceGroupName -Name $nicName -Subnet $subnet -Location $location -PrivateIpAddress $newVMIP -DnsServer $dnsServer1,$dnsServer2 -PublicIpAddress $pip -NetworkSecurityGroup $NSG $newVM = New-AzureRmVMConfig -VMName $newVMName -VMSize $newVMSize | Add-AzureRmVMNetworkInterface -Id $nic.Id | Set-AzureRmVMOSDisk -VhdUri $vhdPath -Name $diskname -CreateOption attach -Linux -Caching ReadWrite New-AzureRMVM -ResourceGroupName $resourceGroupName -Location $location -VM $newVM -DisableBginfoExtension
I can see that the machine is running as I can view the auto-logged-in desktop in boot diagnostics. However, when I try to SSH or when I try to access the web site over 22 and 443, it's not returning any response. Telnet times out and it's acting like the port isn't forwarding at all.
I understand that because it's Debian 6.x, waagent isn't supported. But I shouldn't need waagent for port forwarding, should I? From what I understand about networking and from what I see in MSDN forums, "The port forwarding should be invisible to your end machine. As the public hits the public port and your VM receives on the internal port." (https : //social.msdn.microsoft.com/Forums/en-US/bd93f5cb-a674-4b9c-aa5a-9f6e7b364f2c/port-forwarding-still-broken?forum=WAVirtualMachinesforWindows)
Did I mis-key or miss something in my PowerShell script? Any ideas?
I have tried deleting and re-creating the VM and I've tried re-uploading the VHD file. I did have to convert it from VHDX to VHD, but that shouldn't matter since it's actually booting up and I see the screen in boot diags.
The NSG I used does work for any other newly created machine via portal or PowerShell, just not this uploaded machine, which makes me think I've flubbed something in the script. Everything does show that it's open for port 22 and 443 though. Here's a screen grab of the Effective Security Rules blade: rules screenshot
The iptables on the local machine are empty as shown in this screen grab.
What's weird is that I can't SSH to it from another machine on the same virtual network either. I tried going through the steps at https : //docs.microsoft.com/en-us/azure/virtual-machines/virtual-machines-linux-debian-create-upload-vhd?toc=%2Fazure%2Fvirtual-machines%2Flinux%2Ftoc.json, but since it's Debian 6, the waagent won't install. But again, I shouldn't need an agent on the machine for port forwarding to work. No other virtualization technology requires an agent for NAT to work.
Edit - this was suggested as a duplicate of StackOverflow. I originally asked the question there, but everyone suggested I post my question here. So I did that, marking the StackOverflow answer as the answer.