Using Linux Virtual Machine on Microsoft Azure Cloud

Microsoft Azure, an open and flexible cloud platform, enables users to build, deploy, and manage applications across the global network of Microsoft-managed data centres. The platform lets the user build applications using any framework, tool, or language, and integrate the public cloud application with existing IT environments. If you want to use a Linux virtual machine on the Azure cloud, this brief post will certainly help you get started.

Microsoft Azure Cloud

The Process


When you create a Linux virtual machine on the Microsoft Azure classic portal, you need to provide the username, password, and SSH public key. The choice of username is subject to following restrain: you cannot use names of accounts (UID<100) that are already present in the virtual machine.

Obtaining Superuser Privileges

The user account specified during the instance deployment of virtual machine is a privilege account and configured by Azure Linux Agent to provide privileges to the superuser account using sudo utility. After logging in using this user account, you will be to run commands as root with command syntax:

# sudo <COMMAND>

You will get the option to obtain the root shell using sudo-s.

Firewall Configuration

Azure has an inbound packet filter to restrict the connectivity to ports specified in Azure classic portal. The only allowed portal is SSH. If you want to open the access to other ports on the machine, you need to configure the endpoints in Azure classic portal.

Note: Linux images in Azure gallery don’t enable iptables firewall. You need to configure the firewall for additional filtering.

Hostname Change

The user has to provide a hostname for the virtual machine upon initial deployment of Linux image. When the machine runs, the hostname is published to platform DNS servers to enable multiple virtual machines connect to each other to perform IP address lookup using the hostname.

If you want to change the hostname after deploying the virtual machine, use command

# sudo hostname <newname>

Virtual Machine Image Capture

Microsoft Azure has the ability to capture the state of a virtual machine into image and use it for deployment of virtual machine instances. You can use Azure Linux agent to rollback some customization performed during provisioning process. To capture the virtual machine as an image, follow these steps:

Run waagent – deprovision to undo provisioning customization


Run waagent – deprovision + user to delete the user-account specified during provisioning and all the data associated to it

Shut down the machine

Click “Capture” in Azure classic portal

You can also use Powershell or CLI tools to capture the machine as an image


Creating a virtual machine on Azure is simple and there are tutorials available on Microsoft Azure website to help the users. If, however, you seek expert guidance, we are here to help. I2k2 networks is a member of Microsoft Azure Elite Circle and specializes in planning and deployment of migrations on Microsoft cloud services. Whether you are looking for full spectrum of platform-as-a-service or infrastructure-as-a-service for Microsoft Azure, our team is ideally placed to deliver. Feel free to get in touch with us for a no-obligation consultation. You can reach us at +91- 9711774040 and +91-120-466 3031.

Please follow & like us :)