Microsoft Azure Documentation

Tutorial: Create and Configure Azure Virtual Machines with Windows

This tutorial guides you through the process of creating and configuring a Windows virtual machine (VM) in Azure. You'll learn how to deploy a VM, connect to it, and perform basic configurations.

Prerequisites

  • An Azure account with an active subscription. If you don't have one, you can create a free account.
  • Basic understanding of cloud computing concepts.

Step 1: Create a Virtual Machine

1.1 Navigate to the Azure Portal

Sign in to the Azure portal. If you don't have an account, you can sign up for a free trial.

1.2 Create a New Resource

In the Azure portal, select Create a resource. You can find this option in the top-left corner of the portal.

Azure Portal Create Resource Button

1.3 Select Virtual Machine

In the search bar, type "Virtual machine" and select Virtual machine from the results. Then, click Create.

1.4 Configure Basic Settings

On the Create a virtual machine page, fill in the following details:

  • Subscription: Choose your Azure subscription.
  • Resource group: Click Create new and enter a name for your resource group (e.g., MyResourceGroup).
  • Virtual machine name: Enter a unique name for your VM (e.g., MyWinVM).
  • Region: Select the Azure region closest to you or your users.
  • Availability options: For this tutorial, select No infrastructure redundancy required.
  • Security type: Choose Standard.
  • Image: Select Windows Server 2022 Datacenter or another desired Windows Server image.
  • Size: Choose a VM size. For testing, Standard_DS1_v2 is a good starting point.
  • Administrator account:
    • Username: Enter an administrator username (e.g., azureuser).
    • Password: Enter a strong password and confirm it.
  • Inbound port rules:
    • Public inbound ports: Select Allow selected ports.
    • Select inbound ports: Choose RDP (3389) to enable remote desktop access.

Ensure you save your username and password securely. You'll need them to connect to the VM.

1.5 Configure Disks

For the OS disk type, select Premium SSD for better performance or Standard SSD for a balance of performance and cost. The default data disk settings are usually sufficient for this tutorial.

1.6 Configure Networking

Azure automatically creates a virtual network, subnet, public IP address, and network security group (NSG). You can accept the defaults for this tutorial.

1.7 Review and Create

Click Review + create. Azure will validate your configuration. Once validation passes, click Create.

The deployment process can take a few minutes. You can monitor the progress from the notification icon in the Azure portal.

Step 2: Connect to Your Virtual Machine

2.1 Get the Public IP Address

Once the VM deployment is complete, navigate to your VM resource in the Azure portal. On the Overview page, find the Public IP address and copy it.

Azure VM Overview Public IP

2.2 Connect using Remote Desktop Protocol (RDP)

On your local Windows machine:

  1. Open the Remote Desktop Connection application (search for "RDP" in the Start menu).
  2. In the Computer field, paste the Public IP address of your Azure VM.
  3. Click Connect.
  4. When prompted for credentials, click More choices, then Use a different account.
  5. Enter the administrator username and password you created in Step 1.4.
  6. You may see a certificate warning; click Yes to continue.

You should now be connected to your Windows VM in Azure.

Step 3: Basic VM Configuration

3.1 Install Updates

Once logged into your VM, it's crucial to install any available Windows updates. Open Settings, go to Update & Security, and click Check for updates.

3.2 Configure Network Security Group (Optional)

If you need to open additional ports for applications (e.g., IIS for web hosting on port 80), you'll need to modify the Network Security Group associated with your VM's network interface.

  • In the Azure portal, find your VM and click on its Network interface.
  • Under Settings, select Network security group.
  • Go to Inbound security rules and click Add to create a new rule for the desired port.

Be mindful of security when opening ports to the internet.

3.3 Install Applications

You can now install any software or configure roles and features on your Windows VM as you would on a physical server.

Step 4: Clean Up Resources

To avoid ongoing charges, it's important to clean up the resources you created. The easiest way is to delete the resource group.

4.1 Delete the Resource Group

  1. In the Azure portal, search for Resource groups.
  2. Click on the resource group you created (e.g., MyResourceGroup).
  3. Click the Delete resource group button at the top.
  4. Confirm the deletion by typing the resource group name and clicking Delete.

This will delete all resources within the group, including your virtual machine.

Conclusion

Congratulations! You have successfully created, connected to, and configured a Windows virtual machine in Azure. You can now leverage Azure VMs for a wide range of computing needs.

This tutorial provides a basic introduction. Azure offers many advanced features for VM management, scaling, security, and high availability. Explore the Azure documentation for more in-depth information.