Recent Posts

Cloud computing, Azure and the capture of virtual machines

Cloud Providers

Lately, the power of cloud computing has been the acknowledged as one of the main infrastructures for any successful startup.

The diversity in the cloud providers is huge, although the main players are:

  1. Amazon - AWS

  2. Microsoft - Azure

  3. Google - GCloud

and several others like DigitalOcean and IBM with Bluemix.

Amazon still holds most of this market, and its competitors are looking for any way possible to infiltrate the market, as such, there are many opportunities for companies, especially startups to leverage this momentum for their side.

Having said that, we are working with Microsoft Azure, for several reasons.

The current state of the Azure cloud is in between stages, main infrastructure change, this leads to bad documentation and sometimes to bad user experience, although the functionality is there and sometimes extremely easy to use.

Azure issues

There are two ways to use the Azure, one is the classic model and the other is the resource manager.

The classic model has all the documentation and explanation a developer of a sysadmin could ever want.

The resource manger is mature in its abilities but still lack some of the documentation and easy to find how to articles.

The recommended option by Microsoft is the resource manager.

An example for this use case is how to create a virtual machine, with Linux OS, modify it and then save it as a custom image.

In the classic model, there you go: link

In the resource manager option, and the OS required is windows, a guide can be found here

Capture Linux machine in azure

1. First things first, we need to generalize the machine using the following command:

use ssh to connect to your Linux machine, then:

sudo waagent -deprovision

then, exit ssh.

Open Azure Power Shell

$groupname = "ChangeMegroup"

$vmname = "ChangeMevm"

Login-AzureRmAccount Stop-AzureRmVM -ResourceGroupName $groupname -Name $vmname

Set-AzureRmVM -ResourceGroupName $groupname -Name $vmname -Generalized

Save-AzureRmVMImage -ResourceGroupName $groupname -VMName $vmname -DestinationContainerName 'templates' -VHDNamePrefix 'template'

This will result in the output of a json that can be used in order to create this image, using the steps found here

Hope this helps anyone,

Comments are appreciated