Can't get Azure Virtual Machine to serve websites

Andy Roper picture Andy Roper · Oct 25, 2013 · Viewed 38.6k times · Source

I've just set up a windows azure VM and installed IIS on it.

When I remote desktop onto the box I can see the default IIS website fine but I can't get this to serve on the web from the IP address of the box.

I've opened up port 80 on windows firewall and also added an endpoint for port 80.

I've tried to access it with the firewall completely turned off also but to no avail...

I cant work out if there is anything else I need to do to get this working?

Answer

Steven De Kock picture Steven De Kock · Jan 25, 2015
  1. Add endpoints for port 80 (http) and port 443 (https) to the VM in the Azure portal (tip: this can be automated with powershell or the Azure cli).

  2. Remote desktop to the machine. Open the Windows firewall control panel and allow traffic to port 80 (http) and port 443 (https) or just turn it off ... the firewall is ON by default (tip: can also be scripted through the VM agent / powershell).

  3. Go to the Azure portal and find the cloudapp.net subdomain for your VM (actually the cloud service) your VM is running under. Try accessing the site with that domain. If that doesn't work, try browsing to http://localhost on the server (remote desktop) to make sure IIS works and troubleshoot from there.

  4. Modify the DNS records of your custom domain to use a CNAME to the .cloudapp.net domain. If you need A records make sure to use the public IP of the cloud service (just ping the .cloudapp.net domain to find it or look in the Azure portal).

You might want to look into Azure Websites or Azure Cloud Services (web roles). Those are a lot easier to manage and a lot cheaper. They still offer most of the functionality.