Introduction
This documentation provides a comprehensive guide to launching a virtual machine (VM) in Microsoft Azure, configuring network settings, and securely accessing the machine using Remote Desktop Protocol (RDP) or Secure Shell (SSH). Azure's cloud platform offers a flexible and secure environment to run VMs for various purposes, including development, testing, and production.
Prerequisites
An active Azure subscription.
Azure Portal access credentials.
Steps to Launch a Virtual Machine on Azure
1. Log in to the Azure Portal
Navigate to the Azure Portal.
Enter your login credentials.
2. Create a Virtual Machine (VM)
A. Navigate to Virtual Machines
- In the left-hand menu, select Virtual machines under the “Compute” section or use the search bar at the top.
B. Create a New VM
- Click on the + Create button and select Virtual Machine from the dropdown.
C. Configure VM Settings
You will be redirected to the Create a virtual machine form. Configure the following sections:
Basics Tab: VM Setup
Subscription: Select your Azure subscription.
Resource group: Create a new resource group or select an existing one.
Virtual machine name: Provide a unique name for your VM.
Region: Choose the Azure region for deployment, considering latency, cost, and compliance.
Availability options: Choose between an availability set or zone redundancy based on your architecture needs.
Image: Select the operating system for your VM (e.g., Windows Server, Ubuntu, etc.).
Size: Choose the VM size according to your compute requirements (CPU, RAM). Use the View all sizes option to compare prices and specifications.
Authentication type:
For Linux: Choose either SSH public key or Password.
For Windows: Choose Password.
Username and Password: Enter the admin username and password for login.
Disks Tab: Configure Storage
Choose the disk type to attach to the VM:
Premium SSD (for high-performance workloads)
Standard SSD (for balanced performance)
Standard HDD (for cost-effective options with lower I/O demands)
Networking Tab: Configure Network
Virtual Network (VNet): Create a new virtual network or select an existing one.
Subnet: Choose or create a new subnet to partition your VNet and assign IP address ranges.
Public IP Address: Create a new public IP address for internet accessibility.
NIC Network Security Group (NSG): Create or select an NSG with inbound and outbound traffic rules:
For SSH (Linux): Add an Inbound Port Rule for SSH (22).
For RDP (Windows): Add an Inbound Port Rule for RDP (3389).
Accelerated networking: Enable this feature for enhanced network performance, especially for high-performance workloads.
Management Tab: Configure Monitoring
Boot diagnostics: Enable to help troubleshoot startup issues.
Monitoring options: Enable services like Azure Monitor or set up automatic shutdown schedules for cost control.
D. Review and Create
Click on Review + create. Azure will validate your settings.
Once validation is complete, click Create to launch the VM.
3. Access Your Virtual Machine
A. Accessing via SSH (Linux)
After deployment, navigate to Virtual machines in the Azure portal.
Click on your VM and copy the Public IP address.
Open your terminal and run the following command:
ssh <username>@<Public-IP-Address>
Example:
ssh azureuser@52.168.25.14
If using a private key for SSH authentication, specify the path:
ssh -i /path/to/privatekey <username>@<Public-IP-Address>
B. Accessing via RDP (Windows)
Navigate to Virtual machines in the Azure portal and click on your VM.
Copy the Public IP address.
On your local machine, open Remote Desktop Connection:
- Press Windows Key + R, type
mstsc
, and hit enter.
- Press Windows Key + R, type
In the Remote Desktop Connection dialog, enter the Public IP address of your VM and click Connect.
Enter the admin username and password provided during VM creation.
Click OK to connect to your Windows VM.
4. Configure Network Security (If Required)
If you face connectivity issues, verify the NSG rules:
Go to your VM’s Networking section in the Azure portal.
Ensure the inbound rule for SSH (Linux) or RDP (Windows) is configured to allow access from your public IP address or anywhere (0.0.0.0/0).
For enhanced security, limit allowed IP ranges to trusted IP addresses.
5. Optional: Set Up Auto-shutdown
In the Management tab, enable Auto-shutdown for cost optimization.
Select the shutdown time (UTC) and provide an email address for notifications.
This feature ensures the VM powers off when not in use.
Conclusion
By following this guide, you can successfully launch a virtual machine in Azure and access it securely. Proper configuration of network settings and utilization of RDP or SSH allows you to leverage Azure’s flexibility and scalability for your applications. You have now created a robust environment ready to support various workloads in the cloud.