Quickstart: Create and Manage Azure Virtual Machines
Welcome to the Azure Virtual Machines quickstart guide. This guide will walk you through the essential steps to create, configure, and connect to your first Azure Virtual Machine (VM).
What is an Azure Virtual Machine?
An Azure VM is an on-demand, scalable computing resource that Azure offers. You can think of it as a personal computer in the cloud. Azure VMs are versatile and can be used for a wide range of computing workloads, from hosting applications to running development and test environments.
Prerequisites
- An active Azure account. If you don't have one, you can create a free account.
- A subscription.
Step 1: Create a Virtual Machine
Using the Azure Portal
- Sign in to the Azure portal.
- In the portal's search bar, type "Virtual machines" and select "Virtual machines" from the search results.
- On the Virtual machines page, select "Create" and then "Virtual machine".
- In the "Basics" tab:
- Subscription: Select your Azure subscription.
- Resource group: Create a new resource group or select an existing one. 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: Select a geographic location for your VM.
- Availability options: For this quickstart, you can leave the default.
- Security type: Leave the default "Standard".
- Image: Select an operating system image. Ubuntu Server 20.04 LTS is a common choice.
- Size: Choose a VM size. For testing, a smaller size like
Standard_B1s
is often sufficient. - Administrator account:
- Authentication type: Choose either SSH public key or Password. Password is simpler for quickstarts.
- Username: Enter an administrator username (e.g.,
azureuser
). - Password: Enter and confirm a strong password.
- Inbound port rules: Select "Allow selected ports" and choose SSH (22) and HTTP (80) if you plan to host web content.
- Click "Review + create".
- Review your VM settings and click "Create". Deployment can take a few minutes.
Important: Secure your VM by using strong passwords or SSH keys. For production environments, consider more advanced security configurations.
Step 2: Connect to the Virtual Machine
Connecting via SSH (Linux)
- Once the VM deployment is complete, navigate to the VM resource in the Azure portal.
- On the "Overview" page, you'll find the VM's public IP address. Copy this IP address.
- Open a terminal or SSH client on your local machine.
- Use the following command, replacing
and
:ssh
@ - If you used a password for authentication, you'll be prompted to enter it. If you used an SSH key, ensure your key is configured correctly.
- You should now be connected to your Azure VM.
Connecting via Remote Desktop (Windows)
- On the VM's "Overview" page in the Azure portal, click the "Connect" button and select "RDP".
- Download the RDP file.
- Open the downloaded RDP file.
- Click "Connect". You may see a warning about the publisher; click "Connect" again.
- Enter the username and password you created during VM creation.
- You should now be connected to your Windows VM.
Note: If you encounter connection issues, ensure that your network security group (NSG) allows inbound traffic on the required ports (e.g., port 22 for SSH, port 3389 for RDP).
Step 3: Clean Up Resources
When you are finished with your virtual machine, you should delete the resource group to avoid ongoing charges. Deleting the resource group deletes all the resources within it, including the VM, its virtual network, and storage.
- In the Azure portal, navigate to "Resource groups".
- Find and select the resource group you created for your VM.
- At the top of the resource group page, select "Delete resource group".
- Confirm the deletion by typing the resource group name and clicking "Delete".
Next Steps
Congratulations! You have successfully created and connected to an Azure Virtual Machine. Here are some resources to continue your learning:
Explore More Tutorials