Azure virtual machines (VMs) can be created through the Azure portal. The Azure portal is a browser-based user interface to create Azure resources. This lab show you how to use the Azure portal to deploy a Linux virtual machine (VM) running Ubuntu Server 22.04 LTS. To see your VM in action, you also SSH to the VM and install the NGINX web server.
Create virtual machine
1.Navigate to https://portal.azure.com.- Sign in with your Azure account credentials.
- Enter
virtual machinesin the search.
2.Under Services, select Virtual machines.
In the Virtual machines page, select Create and then Azure
virtual machine. The Create a virtual machine page opens.
3.In the Basics tab, under Project details, make sure the correct subscription is selected and then choose or Create new resource group. Mine is myResourceGroup.
4.Under Instance details, enter myVM for the Virtual machine name, and choose Ubuntu Server 22.04 LTS – Gen2 for your Image. The default size and pricing is only shown as an example. Size availability and pricing are dependent on your region and subscription.
5.Under Administrator account, select password.
6.In Username enter azureuser.
7.Enter password and confirm password.
8.Under Inbound port rules > Public inbound ports, choose Allow selected ports and then select SSH (22) and HTTP (80) from the drop-down.
9.Navigate to Monitoring tab > Diagnostics > select Disable.
- Navigate to Tags tab. Create Tag (Name **and **value). Then select the Review + create button at the bottom of the page.
10.On the Create a virtual machine page, you can see the details about the VM you are about to create. When you are ready, select Create.
11.When the deployment is finished, select Go to resource.
12.On the page for your new VM, select the public IP address and copy it to your clipboard.
13.Increase the Idle timeout (minutes) to 30.

Connect to virtual machine
Step 1: Connect to the Linux VM Using SSH
- Use password authentication to log in to the server:
ssh username@hostname_or_ip
- After running this command, enter the password when prompted.
Step 2: Switch to Root User
- Ensure you have root privileges by switching to the root user:
sudo su
- This allows you to install software without permission issues.
Step 3: Install Nginx on the Server
Run the following command to install Nginx:
apt update
Then
apt install nginx -y
🔹 apt → The package manager for Ubuntu/Debian-based systems.
🔹 install → The action to install a package.
🔹 nginx → The software package to install.
🔹 -y → Automatically confirms the installation without prompting.
Step 4: Verify the Installation
- Once the installation is complete, verify that Nginx is running by checking its status:
systemctl status nginx
- If the service is active, it should show
active (running).
Step 5: Test in a Web Browser
- Copy the public IP address of the VM and paste it into a browser:
http://
- If Nginx is installed correctly, you should see the default Nginx welcome page.
Conclusion
Creating a Linux virtual machine in the Azure Portal is a straightforward process that gives you a powerful and flexible environment for hosting applications, running workloads, or experimenting with cloud technologies. By following these steps, you’ve learned how to select an image, configure size and networking, and deploy a VM in minutes.
This is just the beginning, once your VM is up and running, you can:
Secure it with Network Security Groups and Azure Firewall.
Automate deployments using Azure CLI, PowerShell, or ARM templates.
Scale resources based on demand and integrate with other Azure services like Storage, Monitoring, and Backup.
Mastering VM creation is a key skill for cloud professionals, and Azure makes it easy to get started. Keep exploring and building!
Thanks for reading — see you in the next one


















