Quickstart: Create a Linux Virtual Machine in Azure
This guide will walk you through the steps to create your first virtual machine (VM) in Azure using the Azure portal. A VM in Azure is an on-demand, scalable computing resource that provides the flexibility of virtualization for computing infrastructure but without the need to buy and manage the underlying physical hardware.
Sign in to the Azure portal
Open your web browser and navigate to https://portal.azure.com/. Sign in with your Azure account credentials.
Create a Virtual Machine
In the Azure portal search bar, type Virtual machines and select it from the services list.
On the Virtual machines page, select + Create and then select Virtual machine.
Basics Tab
On the Create a virtual machine page, select the Basics tab.
- Subscription: Select your Azure subscription.
- Resource group: Create a new resource group by selecting Create new and entering a name (e.g.,
myResourceGroup), or select an existing one. - Virtual machine name: Enter a unique name for your VM (e.g.,
myVM). - Region: Select a region close to you or your users.
- Availability options: For this quickstart, you can leave this as No infrastructure redundancy required.
- Security type: Select Standard.
- Image: Select an operating system image. For example, select Ubuntu Server 20.04 LTS.
- Size: Choose a VM size. For this quickstart, Standard_B1s is usually a cost-effective option.
- Administrator account:
- Authentication type: Select SSH public key (recommended) or Password.
- If using SSH public key:
- Username: Enter a username (e.g.,
azureuser). - SSH public key source: Select Generate new key pair and enter a name for the key pair (e.g.,
mySshKey), or select Use existing public key if you have one.
- Username: Enter a username (e.g.,
- If using Password:
- Username: Enter a username (e.g.,
azureuser). - Password: Enter a strong password.
- Confirm password: Re-enter the password.
- Username: Enter a username (e.g.,
- Inbound port rules:
- Public inbound ports: Select Allow selected ports.
- Select inbound ports: Choose SSH (22). This allows you to connect to your VM later.
Click Next: Disks >.
Disks Tab
On the Disks tab, you can configure the OS disk and data disks. For this quickstart, the default settings are fine. Click Next: Networking >.
Networking Tab
On the Networking tab, configure networking settings. For this quickstart, the default settings are typically suitable. You'll see a virtual network, subnet, public IP address, and network security group created by default. Click Next: Management >.
Management, Advanced, and Tags Tabs
Review the settings on the Management, Advanced, and Tags tabs. For this quickstart, you can accept the default values. Click Next: Review + create >.
Review + create
On the Review + create tab, Azure will validate your configuration. If validation passes, you will see a Validation passed message.
Review the summary of your VM configuration. If everything looks correct, click Create.
If you chose to generate a new SSH key pair, you will be prompted to download the private key. Download this private key and store it securely. You will need it to connect to your VM.
Connect to your Virtual Machine
Once the deployment is complete, navigate to your VM's overview page.
- Find the Public IP address of your VM on the overview page.
- Open your SSH client (e.g., PuTTY on Windows, or the built-in terminal on Linux/macOS).
- Connect to your VM using the following command, replacing
with the username you specified andwith your VM's public IP:ssh@ - If you used a password for authentication, you will be prompted to enter it. If you used SSH public key authentication, and you've stored your private key correctly, you should be connected directly.