Creating Debian VM on Windows Azure - Part 1

Today we will start to create Debian VM on Windows Azure based on Debian Wheezy image. It is not that simple as create Ubuntu VM as it is not listed by default on standard list when you create Linux VM or in VM Depot list in Management Portal.

But first we will set up everything the right way, including Affinity Groups, Storage, and Virtual Network. There is a shortcut, especially for several standard Linux images, that does some of the stuff below automatically, but it is better to start using own names, structure etc. from the beginning.

Create Affinity Group

Log into Azure Management Portal. Go to the SETTINGS and then click AFFINITY GROUPS. Click NEW. Choose the descriptive name and the region (data center) where you want everything to be hosted. It is best to select the one nearest to most of your clients for lower network latency.

Create storage account for VMs

Go to Azure Management Portal. Click New on the bottom, then DataServices/Storage/Quick Create. Enter the URL (prefix), choose previously created affinity group (the same where on which the VMs will be run), turn off Geo replication if you want (it is cheaper and not that important in case of images/disks).

After creating storage account go to the created storage account and click CONTAINERS tab. Then click ADD CONTAINER on the bottom. Create two containers with private access: vms and disks. First will be used for virtual machine images and system disks. Second will be used for data disks. You can also create only one container if you want.

Create Virtual Network

It is an optional step, but it is better to do it manually as you will have greater control later on.

In Azure Management Portal go to NETWORKS part. Click on CREATE A VIRTUAL NETWORK. The wizard popup will show up. Select descriptive name and previously created affinity group.

If you want, configure VPN (I'm using point to site connectivity). Please remember that active VPN connection will be additional position on the bill, but if you want to have something that has no external visibility on vms, it is the one of the solutions. Go to the next screen.

Configure your network addresses range, your subnetworks and gateway if VPN was also configured. Click OK to finish and wait for virtual network creation.

If you added VPN in previous steps. It is still not all. When the virtual network will be created, click on it. Go to the DASHBOARD and click CREATE GATEWAY. You once more need to wait. After point to site gateway creation completed, you have to create and upload certificate. The step by step guide is available here (yes, it is not a piece of cake, but most of it is one time thing).

Install Azure Command Line Tools

As you won't find Debian Wheezy image in Management Portal, you have to use Azure command line tools. Please download the Cross-Platform ones even if you are using Windows, as this is the one used in later ports. For Mac OS or Linux there is only one option.

There is an alternative installation method (which I prefer). It is not much harder and makes the updates in the future dead simple (just one command).

Install node.js. Make sure you will restart console window you use after installation as npm may not be visible otherwise. Run the below command:

npm install -g azure-cli

This will install newest azure command line tools globally. You can rerun it in the future to check for updates. Run azure command to check if all is working (you should get a help info).

Configure Azure Command Line Tool

This is a one time configuration step (unless you change your subscription). It will install management keys on local computer.

In console window run below command:

azure account download

This will open default browser and download the publish settings file with keys. If you are not logged in, you will be asked to log in to Azure. One more command and everything will be set up. Run below command:

azure account import [file.publishsettings]

It is better to remove the publish settings file after importing it.

Uff. We have completed the preparations. Part 2 (available soon) will create the VM OS disk from Debian image, configure it a little, add data disk...