Can't access Azure VM HTTP Web Site from Outside of Azure - azure

I've setup a VM and installed IIS. I checked that the firewall rules were enabled for HTTP and HTTPS. Furthermore, in Azure Portal, I've enabled the two predefined inbound security network group rules for HTTP and HTTPS.
When in the VM, I can go to localhost and see the default Web page of IIS Default Web Site.
Inbound security rule in Network Security Group
Anybody know how to go about figuring out how to make this work?
Thx

You should add port 443 and port 80 to azure VM windows firewall inbound rules.

Are the Source port ranges on your inbound rules set to 80/443 or * (i.e. all source ports)?
Try changing them to * with only the destination ports set to 80 or 443 respectively.
Ex:
Refer How to open ports to a virtual machine with the Azure portal for more details.

There are two ways to make your site accessible from the Internet.
Use the public IP address which is associated to the virtual machine's NIC.
Configure DNS for your VM machine (e.g. web.southeastasia.cloudapp.azure.com). This DNS is bounded to the associated public IP Address.
Reference: https://learn.microsoft.com/en-us/azure/virtual-machines/windows/portal-create-fqdn
In your IIS, just configure binding to make sure the incoming request from the Internet is recognized by IIS.
You also need to make sure you have no rule in Network Security Group (NSG) blocking port 80. Or if there is a NSG, you need to create an inbound rule to allow port 80.

I Azure Windows VM, apart from configuring the NSG rule, we should also create a Windows firewall rule to allow inbound TCP connections on the required port. Just RDP into your windows VM, open Windows Defender Firewall and add the rule

Related

How to setup Azure virtual machine port rules to allow PsExec traffic?

I run PsExec on VirtualMachine01 which connects and perform an action on VirtualMachine02 both hosted in Azure.
That's the command:
PsExec.exe \\VirtualMachine02.publicaddres.com IISReset /restart
In order to allow a traffic through Azure I started with the fastest and the most insecure config. These are the rules I added on Azure in Networking panel:
VirtualMachine01: allow all outbound traffic from any port any protocol
VirutalMachine02: allow all inbound traffic from any port any protocol
How can I set up port rules specifically to the command I run?
I read that PsExec dynamically allocates ports but in Azure there's no way to add firewall rule like Windows Remote Management or Windows COM+ Remote Administration like you could set up directly in Windows.
You need to add the port 135,445 and dynamic port 49152-65535 to the inbound rule of the NSG attached with Virtual Machine02.

Assign public IP to VM on Microsoft Azure

I have created a VM instance on Windows Azure is a Windows Server 2016 and I have deployed a web application on the server. When I run the web application with localhost or private IP and it's all working fine. But, when I try typing the address with the public IP address that provided by the Azure VM instance, and the page just didn't show up.
I thought the default assigned public IP should have already mapped it to the private IP address?
Please advice.
Thank you.
Updated the NSG setting with the advice. Still no luck!
Have you allow port in NSG inbound firewall settings and OS's firewall inbound rules.
Please follow this article to add port to NSG inbound rules via Azure portal.
Also you should add ports to OS firewall inbound rules.
Note:
NSG can associate to Vnet and Subnet, please check them.
Here a similar case about it.
Azure blocks all ports by default, you need to open port 80 (443 if you are using SSL) and map them to port 80 on the server
https://learn.microsoft.com/en-us/azure/virtual-machines/windows/nsg-quickstart-portal
I think the config is on VMs > Networks > Inbound Rules

Create HTTPS endpoint for Azure Virtual Machine

I have created a virtual machine in Azure and enabled the IIS role.
I have created the appropriate firewall rules to allow me to browse to a website that I have set up in IIS over HTTP.
However, despite having created the bindings and firewall rules to enable HTTPS, I am unable to browse to the same website over HTTP.
I have been reading that I need to create a HTTPS endpoint for Azure to traffic any requests on port 443 to my site.
Does anyone know how to do this in the new portal?
Thanks,
Sean
By default, when you create a VM, only port 3389 (RDP) is opened. You will need to add any additional ports that you need to the Network Security Group.
Here is an example of how to add an NSG inbound rule to allow traffic on port 80 (HTTP), but you can use the same steps to allow traffic on port 443 (HTTPS):
https://learn.microsoft.com/en-us/azure/virtual-machines/windows/nsg-quickstart-portal
Ok, so I have got this working so I will document the steps that I went through in order to get this to work:
Create a public IP address in the Azure portal
Assign a ‘cloudapp.azure.com’ DNS name to the IP address
Associate the IP address to an Azure network interface (this network interface may be attached to a VM or an App Service – in our case, it’s a VM)
Create an http endpoint in IIS and set the host name in your bindings to the ‘cloudapp.azure.com’ DNS name and the the IP address to the IP address created in step 1
Create a https endpoint and select your wildcard server certificate as the SSL certificate
Create a ‘CNAME Record’ entry in your DNS Configuration where the host is your custom DNS name and the target is the Azure DNS name
Open a web browser and browse to your custom DNS name via https and ensure that the website displays the server certificate

open port on azure while logged onto azure vm

I want to open a port on Azure. I am logged onto Azure VM. After that how to do I open the port?
I tried opening the firewall port but that did not help. I also tried to do it thru azure-cli but it needs web login.
Can I not open a port while logged in onto that Azure VM?
For VMs in azure service management mode:
To open a particular port, say 8080 in your VM, you have to add an endpoint in azure portal, powershell or using xplat-cli. Once this is done, you have created a connectivity between external loadbalancer (I mean VIP of the VM) to the actual VM (with Internal IP address). If the VM is Linux, by default you can start using endpoint (VIP and port) it unless you restrict ports specifically.
For windows VM, for non standard ports, you have to add windows firewall inbound allow rules (say for 8080) inside your VM so that it can accept traffic forwarded from VIP
For VMs in azure resource management:
You have to first create a loadbalancer with VIP, then add NAT rules to forward traffic from VIP to VM. (use load balancing rules if same VIP port forwards traffic to multiple backend VMs)
For windows VM, again windows firewall inbound rules needs to be added
Securing ports:
The above scenario will work by default, but if you want to secure your ports, you have to follow either one of the below, not both.
Use Access control List (ACL): This works at VIP endpoint level. If we want to restrict VIP port 8080 to only few Ip and deny other IP, we can use ACL to add those IPs. This can be done in portal endpoint section/powershell/Xplat-cli
Use Network Security Group (NSG): This works at pheriphery of VM level. We have greater control here to restrict multiple VM ports, port range, etc., but we have to manage those rules. The ports needs to be secured in NSG is the VM internal port whereas in ACL it is the VIP port.
Hope this clarifies
You also need to open the port in the Endpoint settings within the Azure Portal.
Go to Azure Portal -> Your VM -> Settings -> Endpoints and add your Port.
To open a port, you have to it from the azure portal and not in the VM. You can use the NSG (Network Security Group) attached to vm and add a rule in the "Inbound security rules"

Not able to access application hosted on Linux VM on Azure cloud

I have created a CentOS 7.1 VM using Resource Manager deployment model.
I am not able to access the application using a browser on a machine connected to internet.
However I am able to access the application on same machine and other VM on same virtual network using private IP address.
I configured Network Security Group and allowed port 80 and 443 in Inbound Rules.
Well, it turned out that I needed to open ports under "Inbound Security Rules" and needed to open all in "Source Port Range". For doing so, i needed to put * there and in Destination port for https - 443 etc.
This * thing was the catch which i was missing in all the Inbound security rules for allowing the ports.

Resources