DEV Community

Cover image for How to Create a Windows Server Virtual Machine and install and IIS Web server role on the VM
chifum
chifum

Posted on

How to Create a Windows Server Virtual Machine and install and IIS Web server role on the VM

In this article, we will guide you through the process of creating a virtual machine and installing the IIS web server role on it.

Let’s get started!

To proceed, search for "Virtual Machine" in your cloud service provider's dashboard or management console and select it from the search results.
Image description

To create a new virtual machine, click the + Create button at the top-left or extreme-left corner of the page.

Image description

From the available options, select Azure Virtual Machine to proceed with setting up your virtual machine.

Under Project Details, click on ** Create New ** for the Resource Group option. Provide a name for the resource group—ideally, make it unique or reflective of your project name for easy identification.

Image description

Under Instance Details, provide a name for your virtual machine. Choose a meaningful name that reflects its purpose or role in your project.

Image description

In the Region field, select a region of your choice. Consider choosing a region that is closest to your location or the location of your target users for better performance and reduced latency.

Image description

Under Availability Options, select the Availability Zones based on your desired level of availability.

  • Zone 1 and Zone 2: Choose these if you want your virtual machine to be highly available.
  • Zone 1, Zone 2, and Zone 3: Opt for this if you need your virtual machine to be very highly available.

Keep in mind that higher availability typically comes with increased costs, so choose an option that aligns with your budget and project needs.

Image description

Then select a Windows Server

Image description

Leave all other settings at their default values. Then, under the Administrator Account section, create a Username and Password of your choice. Make sure to use a strong password for security purposes. Keep these credentials safe, as you will need them to log into your virtual machine.

Image description

Under the Select Inbound Ports section, choose HTTP. This will allow incoming HTTP traffic, enabling you to view your virtual machine as a web page once the IIS web server is installed and configured.

Image description

Select Licencing

Image description

Click on the Monitoring tab and locate the Boot Diagnostics option. Set it to Disable to turn off boot diagnostics for your virtual machine.

Image description

Next, click on the Tags tab. Here, you can tag your virtual machine by entering a key-value pair, such as your name or your company's name, to easily identify and manage the resource. For example:

  • Key: Environment
  • Value: Production

Image description

Click on the Review + Create button. The system will validate your configurations. Once the validation is successful and a green checkmark appears, proceed by clicking the Create button to deploy your virtual machine.

Image description

Once the validation process is complete and passes successfully, click on the Create button to finalize and deploy your virtual machine.

Image description

After the deployment is complete, click on the Go to Resource button. This will take you to the management page for your newly created virtual machine.

Image description

Click on the Connect button to establish a connection to your virtual machine. Select your preferred connection method, such as RDP depending on the operating system and your setup.

Image description

Click on Select under the Native RDP option for a local machine. This will allow you to connect to your virtual machine using the Remote Desktop Protocol (RDP) client installed on your computer.

Image description

A pop-up will appear on the right side of the screen. Wait for it to validate and show that the configuration is complete. Once it is configured, click on the option to Download the RDP File. This file will be used to connect to your virtual machine.

Image description

Once the RDP file has finished downloading, click on it to open it, then select Connect to establish a remote connection to your virtual machine.

Note: If you are using a MacBook, you will need to download and install the Microsoft Remote Desktop App from the App Store to use the RDP file.

Image description

When prompted, enter the password you created earlier during the Administrator Settings configuration. This will authenticate your connection to the virtual machine. Once entered, click OK or Connect to proceed.

Image description

When the security prompt appears, click on Yes to confirm the connection and proceed to access your virtual machine.

Image description

Your Windows Server 2019 Datacenter Edition is now successfully set up and ready to use. You can proceed with installing and configuring additional roles and features as needed, such as setting up the IIS web server.

Image description

To proceed:

  1. Click on the Start Menu.
  2. Type PowerShell in the search bar.
  3. From the search results, right-click on Windows PowerShell (or Windows PowerShell ISE) and select Run as Administrator to open it with administrative privileges.

Image description

To install IIS, follow these steps:

  1. In the Windows PowerShell window (running as Administrator), copy and paste the following command:
   Install-WindowsFeature -name Web-Server IncludeManagementTools
Enter fullscreen mode Exit fullscreen mode
  1. Press Enter to execute the command.

This will install the IIS role along with its management tools on your Windows Server. Wait for the installation to complete. Once done, IIS will be ready to use.

Image description

When the command executes successfully, you will see a confirmation message in PowerShell that looks similar to this:

Success Restart Needed Exit Code      Feature Result
------- -------------- ---------      --------------
True    No             Success        {Web-Server, Web-Mgmt-Tools, Web-Mgmt-Console}
Enter fullscreen mode Exit fullscreen mode

This output confirms that the IIS role and management tools have been successfully installed on your Windows Server. You can now access and configure IIS.

Image description

To verify the installation of IIS:

  1. Open a web browser on your local machine or the virtual machine.
  2. Navigate to http://localhost. If IIS is installed correctly, you will see the default IIS welcome page.

Alternatively:

  1. In the Azure Portal, go to your virtual machine's overview page.
  2. Click on the IP Address (Public IP) displayed under the Networking or Overview section.
  3. Copy and paste the IP Address into your browser's address bar.

If IIS is installed and running, the default IIS welcome page will appear, confirming that the web server is functioning correctly.

Image description

To confirm that the IIS Web Server is installed:

  1. Copy the IP address of your virtual machine from the Azure portal.
  2. Open a web browser on your local machine.
  3. Paste the IP address into the browser's address bar and press Enter.

If the IIS Web Server was installed successfully, you will see the default IIS Welcome Page, which confirms that the web server is up and running. If not, double-check the installation process or ensure that the necessary inbound ports (e.g., HTTP) are open in your VM's network settings.

Image description

As evident from the browser, seeing the IIS Welcome Page confirms that the web server has been successfully installed and is operational. Congratulations on setting up your IIS Web Server on the virtual machine! 🎉

Top comments (0)