How to access private VM IIS from internet in AZURE?

765 Views Asked by At

Please below image: subnetimage

I have below things: 3 VM inside 3 subnet all are in Vnet1. VM1 has enable IIS and it's private access through subnet B.

Is there any ways to allow traffic from VM2 to VM1? I have tried multiple time but didn't worked.

I have followed below MS Docs, but it allows only internally(private) in network, it's not working for internet. https://learn.microsoft.com/en-us/azure/virtual-network/tutorial-create-route-table-portal

I've custom template of this scenarios, You have just apply it and all configuration will be created.

you can access from below link:

https://www87.zippyshare.com/v/bEcvSVnC/file.html

I'm new Here , Please help me out from this issue.

Update : VM1 has assign public IP and I need all traffic from public IP of vm1 from VM2.

Please check below image for more info. enter image description here

1

There are 1 best solutions below

2
On

• I would suggest you to please attach one more NIC (Network Interface Card) to the VM1 in subnet A and enable IP forwarding in that NIC along with enabling the same setting in VM2 in subnet B. Since, VM2 is exposed to the internet and has a public IP address but VM1 doesn’t, thus when you configure the NSG (Network Security Group) of both the NICs, ensure that you are creating inbound as well as outbound rules for ensuring traffic flow smoothly over port 80 and 443 through both the NICs. This will ensure that internet traffic over the designated ports is only forwarded from the VM2 to the VM1 and vice versa.

• Also, if you want to, you can attach the additional NIC to VM1 and associate it in some other subnet, i.e., subnet C or any other subnet. This will ensure that the subnet level NSG in effect can be configured for the related subnets only, i.e., subnet in which the additional NIC for VM1 is added and the subnet for VM2. For more information, kindly refer to the below documentation links on attaching additional NICs to the VMs: -

https://learn.microsoft.com/en-us/azure/virtual-machines/windows/multiple-nics

https://learn.microsoft.com/en-us/azure/virtual-network/virtual-network-network-interface-vm#view-network-interfaces-for-a-vm

Snapshots for reference: -

VM NIC addition

IP forwarding

Update : - Yes, you can surely browse the IIS page by accessing the public IP address of the VM1 in local system through chrome browser. But you will need to open the ports 80 and 443 for inbound traffic access on the VM1's NSG. Also, if you want the VM1 to have a publicly accessible DNS name/label, then you will have to configure the desired DNS name in the VM1 settings. To do the above said configurations, kindly refer to the link below: - https://social.msdn.microsoft.com/Forums/expression/en-US/98da3ab5-3909-4048-b935-95d5f7667ab5/accessing-azure-virtual-machine-iis-website-publicly?forum=WAVirtualMachinesforWindows#:~:text=1-%20Click%20on%20the%20VM,Click%20on%20Save.