Documentation Quickstarts Deploy a Virtual Machine on Azure

Deploy a Virtual Machine on Azure

This quickstart guide will walk you through the process of creating and deploying a Linux virtual machine (VM) on Microsoft Azure using the Azure portal.

Prerequisites

Steps to Deploy a VM

1. Sign in to the Azure Portal

Open your web browser and navigate to the Azure portal at https://portal.azure.com/. Sign in with your Azure account credentials.

2. Create a Resource

In the Azure portal, click on the Create a resource button, usually found in the top-left corner or on the dashboard. Alternatively, you can search for "Virtual machines" in the search bar at the top and select Virtual machines from the results, then click Create.

The Azure portal interface might change over time. Look for options related to creating new services or resources.

3. Select Virtual Machine Creation Options

On the "Create a resource" page, select Compute from the categories on the left, then choose Virtual machine. This will take you to the "Create a virtual machine" page.

You'll need to fill out several sections:

Basics Tab

  • Subscription: Select your Azure subscription.
  • Resource group: Click Create new and provide a name for your resource group (e.g., myVMResourceGroup). A resource group is a logical container for your Azure resources.
  • Virtual machine name: Enter a unique name for your VM (e.g., myVM).
  • Region: Choose an Azure region close to you or your users (e.g., East US).
  • Availability options: For a quickstart, you can leave this as No infrastructure redundancy required.
  • Security type: Select Standard for simplicity.
  • Image: Choose an operating system image. For this guide, select Ubuntu Server 20.04 LTS or another preferred Linux distribution.
  • Size: Select a VM size based on your needs. For testing, a smaller size like Standard_B1s is often sufficient and cost-effective.
  • Authentication type:
    • SSH public key: This is the recommended and more secure method for Linux VMs.
    • Password: If you choose password, you'll need to provide a username and a strong password.
  • Username: Enter a username for the administrator account (e.g., azureuser).
  • SSH public key source: If you selected SSH public key, choose to generate a new key pair or use an existing one. If generating, provide a name for your key (e.g., myKey).
  • Inbound port rules:
    • Public inbound ports: Select Allow selected ports.
    • Select inbound ports: Choose SSH (22). This allows you to connect to your VM via SSH.

4. Configure Disks, Networking, and Management (Optional for Quickstart)

You can proceed through the other tabs (Disks, Networking, Management, Advanced, Tags) by accepting the default settings for this quickstart. However, here's a brief overview:

  • Disks: Here you can choose the type of OS disk (e.g., Standard SSD, Premium SSD) and configure data disks.
  • Networking: This defines the virtual network, subnet, public IP address, and network security group. The defaults are usually fine for a basic setup.
  • Management: Options for monitoring, auto-shutdown, and backup.
For production environments, it's crucial to configure networking and security settings carefully.

5. Review and Create

Once you have configured the necessary settings, click on the Review + create button. Azure will validate your configuration.

Review the summary of your VM settings. If everything looks correct, click the Create button.

6. Deployment and Connection

Azure will now provision your virtual machine. This process typically takes a few minutes. You can monitor the deployment progress in the Azure portal.

Once the deployment is complete, navigate to the resource group you created. You will see your virtual machine and its associated resources.

To connect to your Linux VM:

  1. Click on your VM in the Azure portal.
  2. On the VM's overview page, you will find its Public IP address. Copy this IP address.
  3. Open a terminal or SSH client on your local machine.
  4. Use the following command to connect, replacing <your-username> with the username you specified and <public-ip-address> with the VM's IP address:
    ssh <your-username>@<public-ip-address>
  5. If you used SSH keys, ensure your private key is accessible. If prompted, accept the host's authenticity.
If you chose password authentication, you will be prompted for the password you set.

7. Next Steps

Congratulations! You have successfully deployed a virtual machine on Azure. You can now:

  • Install software and configure your VM.
  • Explore other Azure services like storage, databases, and networking.
  • Learn more about managing your VM, such as resizing, stopping, and restarting.
  • For Windows VMs, the connection process involves downloading a RDP file and using a Remote Desktop client.

Clean Up Resources

When you no longer need the VM and its associated resources, it's important to delete them to avoid incurring further charges. You can do this by deleting the resource group.

  1. Navigate to your resource group in the Azure portal.
  2. Click on the Delete resource group button.
  3. Confirm the deletion by typing the resource group name.
Deleting a resource group deletes all resources within it, including the virtual machine, its disks, and network interfaces.

For more detailed information and advanced configurations, please refer to the full Azure Virtual Machines documentation.