Microsoft Azure provides a multiple ways to create Virtual Machines for Windows or Linux along with their multiple market variations. They are:
- Azure portal UI at https://portal.azure.com
- Azure CLI
- Azure PowerShell commands
I’ll be using the Azure portal UI to create a marketplace image for Ubuntu Linux. Some of the UI features may change in future, but the crux will remain pretty much similar more or less.
Open Marketplace for VM Images on Azure portal
Fill up the VM Image details
- Create or select Resource Group.
- Give a suitable name.
- Select region based on your geographic availability.
- For personal use redundancy is not required. You can change Availability options based on Availability Zone or Availability set.
- Select the Marketplace image for the available Ubuntu version.
- Select a machine size based on vcpus, memory and IOPS requirement. Of course, check the cost factor.
Setup Authentication using Password or SSH public key
You can simply use Username and Password for authentication otherwise use SSH public/private key pair.
For generating SSH public key, use Putty gen for Windows or ssh-keygen on Linux and OSX. You can download a suitable Putty client for windows here.
- Generate RSA 2048-bit key and follow the instructions by the tool.
- Save the Private key file as .ppk
- Save the Public key file as .pub
- Export the Private key file as .openssh format using the Conversions menu if this key will be used by an external SSH client such as on Linux.
For the Admin account, put a suitable Username and SSH public key generated above starting with “ssh-rsa” as shown below. Make sure the key is copied as is without any modifications.
Add Disks information
It’s better to use Premium SSD for optimal performance. If you have additional disks already created you can attach it with the VM at this step or you can also do this later.
This step creates a Virtual Network, a subnet and a Public IP for the VM. All these are added to the same Resource Group while creating these new resources. You can also select if you have these existing resources.
Allow Inbound Ports
You can select the required ports e.g. SSH for connecting using SSH public/private key-pair or RDP to connect using Username and Password.
Keep these to default if you prefer. You can enable/disable any option based on requirement. I turned off Boot diagnostics as it required to create a Storage account so I switched it off, as I don’t require it for a test VM.
You can provide additional post-deployment configuration options using extensions like chef and puppet or Cloud init for Linux.
You can add various tags to categorize resources for consolidated billing and automation management.
Review your provided details in the next step and click on Create. Wait for the deployment to succeed.
Accessing the VM
For accessing the VM, check if you have inbound port rules set up to access using Public IP address with RDP or SSH. Use Putty configuration client to SSH into the VM using port 22 on Windows machine. From a Unix like system including MacOS, use the following command:
ssh <username>@<computer name or IP address>
For details on how to connect to your Ubuntu Linux VM from your Mac machine, check out this post.