How to setup a webserver in an Azure Virtual Machine

December 19, 2016 by Anuraj

Azure Azure VM Virtual Machine

This post is about configuring and running a webserver in Azure Virtual Machine. Azure Virtual Machine is one of IaaS (Infrastructure as a service) offering from Microsoft Azure. Infrastructure as a service (IaaS) is an instant computing infrastructure, provisioned and managed over the Internet. Quickly scale up and down with demand and pay only for what you use.

Hope you’re already created a virtual machine, if not create a virtual machine, it is pretty straightforward.

Create Azure Virtual Machine

I have already created an Azure Virtual Machine with Windows 7 OS. To configure it as webserver, first you need to install IIS, you can do it by Remote Desktop to the machine and install IIS from Programs and Features.

Install IIS from Programs and Features

Once it completed, you need to add exception in firewall to allow incoming / out going traffic.

Adding exception to World Wide Web

Now you have completed the configuration in Virtual Machine. Now you need to modify VM Settings in the Portal. Click on the Virtual Machine name from the all resources list. Select the Network Interfaces menu.

Network Interfaces menu

From the listed network interfaces, click on the network interface, which will open the Network Security Group.

Network Security Group

Inside the Network Security Group settings, select the Inbound security rules option. You will see Remote Desktop rule there.

Network Security Group - Inbound Security Rules

Click add, which will open Add Inbound Rule option.

Add Inbound Rule

Name is for identifying the rule, in this post I am using Web as my inbound rule name, Priority can be anything, rules processed based on priority. Lower the number, higher the priority. Source setting helps to allow traffic from specific IP Address, for web server it can be any. Service to configure the port. You can choose HTTP, which will configure Port number 80 and Protocol also will change to TCP. Action need to set as allow. Once you save this, you can see the rule in the list.

Available inbound rules

Please note that the same rule will apply to all the VMs using the same Netwrok Security Group, which means you can reuse it for all your Web servers for example, while most likely choosing a different one for all your SQL machines. You can now connect directly to your VM using port 80 and the public IP provided in its Dashboard.

Here is the screenshot of the same.

Webserver running an Azure Virtual Machine

Happy Programming :)

Copyright © 2024 Anuraj. Blog content licensed under the Creative Commons CC BY 2.5 | Unless otherwise stated or granted, code samples licensed under the MIT license. This is a personal blog. The opinions expressed here represent my own and not those of my employer. Powered by Jekyll. Hosted with ❤ by GitHub