DEV Community

Cover image for How to Create a Windows Server in Microsoft Azure and Install IIS Server using a powershell
Kosisochukwu Ugochukwu
Kosisochukwu Ugochukwu

Posted on

How to Create a Windows Server in Microsoft Azure and Install IIS Server using a powershell

Introduction
Microsoft Azure offers a highly scalable and efficient platform for deploying Windows Server instances. One frequent use case is to configure a Windows Server with Internet Information Services (IIS) to host websites and applications. This article explains how to setup a Windows Server on Azure and install IIS.

Step 1: Log into Azure Portal

  • Navigate to Azure Portal and log in with your credentials.

Azure Portal

  • On the homepage, click on Create a resource.

Create a resource

  • Create and review

Create and review

Step 2: Create a Windows Server Virtual Machine (VM)

  • On the homepage, search Virtual Machine and click create

Virtual Machine

create

Fill in the required details

  • Subscription: Select your active Azure subscription.

  • Resource Group: Choose an existing resource group or create a new one.

  • Virtual Machine Name: Provide a unique name for the VM.

VM

  • Region: Choose the nearest or preferred Azure region.

  • Availability options: Choose the default (Availability zone)

  • Zone options: Choose the default self-selected zone

  • Availability zone: Choose any zone of your choice depending on the cost

  • Image: Select the version of Windows Server (e.g., Windows Server 2022 Datacenter).

Select the version of Windows Server

  • Size: Select an appropriate VM size based on your workload.

appropriate VM

Configure Administrator Account:

  • Provide a username and strong password.

  • Under Inbound Ports, allow RDP (3389) and HTTP (80) for remote desktop access.

Under Inbound Ports

  • Click Next: Disks and configure storage as per requirements (leave at defaults if neccessary).

Disks

  • Click Next: Networking and configure the Virtual Network and Subnet (for practice purpose leave it at its defaults).

Networking

  • On monitoring: On Boot diagnostics, for practice purposes, click on disable to avoids unnecessary Azure storage costs or monitoring from Microsoft. Again, disabling it speeds up the virtual machine (VM) creation.

Boot diagnostics

  • Tags: Give tag a name and value

tag a name and value

  • Click Review + Create, validate settings, and click Create.

Review + Create

Step 3: Connect to Windows Server

  • Once deployment is complete, go to the Virtual Machines section.

Virtual Machines

  • On the Windows server overview, click on the public ip address to extend the minutes of the idle timeout of the window server created

Image description

Image description

  • Select your newly created VM and click on connect.

created VM

  • Click Connect.

Connect

  • click on select and wait on the right page showing validating to change to configured

showing validating

  • Click Download the RDP file and open it.

Download the RDP

  • Click on check access to change to accessible (otherwise your IIS server that will be installed on PowerShell will not open in any browser)

Image description

  • Download the RDP file and click on connect.

Download the RDP

  • Log in using the credentials set during VM creation.

RDP file

  • Enter your administrator credentials when prompted.

  • You now have a Windows Server 2020.

Windows Server 2020

Step 4: Install IIS (Internet Information Services)

  • Open PowerShell on the Windows server and run the following command to install IIS: Install-WindowsFeature -name Web-Server -IncludeManagementTools

Open PowerShell

Open PowerShell

Install-WindowsFeature

  • Wait for the installation to complete.

installation to complete

  • Once installed, verify the installation by checking the IIS service: Run the command Get-WindowsFeature -Name Web-Server to verify the installation

WindowsFeature

Step 5: Verify IIS Installation

  • Copy the public IP of the window server; note the public address is now showing accessible.

Image description

  • Open a web browser and paste the ip address, If IIS is installed correctly, the default IIS Welcome Page should appear.

IIS is installed

Conclusion

You have successfully set up a Windows Server in Microsoft Azure and installed IIS for web hosting. You may now host and administer websites or applications on your Azure-based Windows Server. For more complex options, look into custom domain setup, SSL certificates, and firewall policies.

Top comments (0)