DEV Community

Cover image for Creating a Windows VM on Azure and Installing Windows Server (IIS) on it

Creating a Windows VM on Azure and Installing Windows Server (IIS) on it

In the previous resource, we discussed how to create a Linux VM and install nginx on it; now let's consider a Windows VM. Setting up a Windows VM can help you meet these needs without the overhead of managing physical hardware. This guide will walk you through the process of creating a Windows VM on Azure and installing Windows Server on it. By the end, you’ll have a fully functional Windows Server environment, ready for any application or workload you want to deploy. Let’s dive into the setup!


Step-by-Step Guide to Creating a Windows VM on Azure and Installing Windows Server on it

Step 1: Create a New Virtual Machine (VM)

  • From the list of search results, click on the Virtual Machine option. The best option is usually highlighted.
    Virtual Machine

  • Click the Create button to start the virtual machine creation process. Choose Create a virtual machine hosted by Azure.
    Create

  • Select the appropriate subscription and create a resource group by clicking the Create resource group button. Give both the Resource group and the VM a name.
    Create resource group

Step 2: Configure the Virtual machine (VM)

  • Provide other information about your virtual machine, such as the operating system (Windows Server Datacenter -x64 G2), size, and other configuration settings. Leave other options as default.
    operating system

  • Create an Administrator Account. Use Azureuser for the username and password123 for the password.

  • Select Inbound Port Rules. Select RDP for a Windows VM. This allows IP addresses to connect to the VM. Also select HTTP, which would help connect your virtual machine to the web.
    Administrator Account

  • Click Next until you reach the Boot Diagnostics in the Monitoring tab, then click on Disable.
    Boot Diagnostics

  • Click Next to the tags tab and then give the VM a tag name, then click Review + Create.
    Review + Create

  • Click on the Create button. If the validation passes, the deployment will proceed. If not, note any recommendations, fix them, and try again. Deployment might take 3-5 minutes.
    Create
    Go to resource

Step 3: Access the Windows Virtual machine

  • Once the virtual machine is deployed, click on the Connect button in the Overview of the virtual machine blade in the Azure portal.

  • Click Native RDP, select, and wait for the configured sign to be displayed on the right-hand side. Download the RDP file.
    Access the Windows VM

  • Open the RDP file from your local computer and click on Connect. Enter the Admin Details created during the VM setup.
    Connect

  • Follow the prompt and click Continue. Use the username and password created for the admin section.
    admin details

  • Once the connection is successful, start using your virtual machine!
    successful

Step 4: Install Additional Windows Server Roles (IIS)

  • Click on the Start menu.
  • Type PowerShell and open Windows PowerShell as an administrator (right-click and select Run as administrator).
    PowerShell

  • Run the following command to install the IIS role and management tools:

Install-WindowsFeature -name Web-Server -IncludeManagementTools
Enter fullscreen mode Exit fullscreen mode

PowerShell

PowerShell

  • If you need specific role services, you can specify them using their feature names. For example:
Install-WindowsFeature -name Web-Server, Web-WebServer, Web-Common-Http, Web-Default-Doc, Web-Dir-Browsing, Web-Http-Errors, Web-Static-Content, Web-Health, Web-Http-Logging, Web-Request-Monitor, Web-Performance, Web-Stat-Compression, Web-Security, Web-Filtering, Web-Basic-Auth, Web-Windows-Auth, Web-App-Dev, Web-Net-Ext, Web-ASP, Web-CGI, Web-ISAPI-Ext, Web-ISAPI-Filter, Web-Mgmt-Tools, Web-Mgmt-Console, Web-Mgmt-Service -IncludeManagementTools

Enter fullscreen mode Exit fullscreen mode
  • You can verify that IIS has been installed by opening a web browser and navigating to http://localhost. You should see the default IIS welcome page.

  • Or just paste the IP address of the VM in a browser and verify that you installed the webserver.

verify

verify

By following these steps, you’ve successfully created a Windows VM on Azure and installed Windows Server. This setup can now be customized based on your needs—whether it's hosting enterprise applications, setting up a database, or managing services. You now have a powerful Windows Server environment that can scale as your requirements grow.


Thank you for reading my blog.😊😊

If you need further assistance, feel free to reach out in the comment or hit me up on Twitter. You can also follow me on GitHub. My DM's are open and love discussions on cloud topics!😁

Top comments (1)

Collapse
 
ayoashy profile image
Ayo Ashiru

Easy to comprehend and well insightful. Thanks for sharing!