|Deletions are marked like this.||Additions are marked like this.|
|Line 31:||Line 31:|
|[[https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager/|Node.js installation instructions]] can be found on github. Note that the current debian package is too old, and you'll need to follow the alternate instructions to compile node yourself.||[[https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager/|Node.js installation instructions]] can be found on github. Note that the current debian package is too old (but unstable is Okay: try "apt-get install npm"), and you'll need to follow the alternate instructions to compile node yourself.|
|Line 61:||Line 61:|
|16 North Europe||16 North Europ|
Cloud/WindowsAzureImage details how to provision a new VM, and how to create a custom image based on the existing one.
Terminology and context
Windows Azure leverages its blob storage system to provide virtual hard drives that serve as system disks for its Virtual Machines capability.
A system disk is a VHD file. It must be uploaded as a Page Blob on Windows Azure (this can be done using a command line utility called azure).
Blobs are stored in Windows Azure Storage, which is separate from Virtual Machines. A Storage Account is the top-level container for blobs. It has a FQDN (mystorageaccount.blob.windows.core.net.), and a symmetric key to protect access. Its default visibility is private.
Once the VHD is uploaded, it can be either:
- declared as a System Disk, and the VHD will be used as-is.
- declared as an Image, and Windows Azure will use a customizable provisioning process.
This document will focus on Images.
the official Windows Azure Images can be listed by calling azure vm image list
There is also a repository of community images, called VM Depot, and maintained by Microsoft Open Technologies. The Debian wheezy Image is available on this repository. The complete list can be obtained by querying http://vmdepot.msopentech.com/OData.svc/Vhds
Linux machines on Windows Azure usually contain an agent dedicated to communications between the underlying infrastructure and the virtual machine. This agent can be called via the waagent command (which is installed on the debian image, and available as a Debian package maintained by Arnaud Patard and Hideki Yamane).
Creation of a debian VM using VM Depot
This is the quickest way to create a new VM.
You must install the azure command-line tool. This tool is written in node.js, which may not be installed on your system. Node.js installation instructions can be found on github. Note that the current debian package is too old (but unstable is Okay: try "apt-get install npm"), and you'll need to follow the alternate instructions to compile node yourself.
Once you have a recent enough version of node.js, install the azure command line tool using npm :
npm install azure-cli -g
You will then need to input your Windows Azure Subscription credentials. These credentials can be obtained by downloading a credentials file. The command to get this file is :
azure account download
You'll then import these credentials
azure account import [downloadedfile]
Many operations described here can also be done using the Azure Management Portal, and you can navigate there by issuing
Every Image in VM Depot has an identifier of the form: vmdepot-aa-bb-cc , where
- aa is the main image identifier (65 for debian wheezy)
- bb is the current version (1 as of 9 January 2013)
- cc is the datacenter region
# location string 1 West US 2 East US 4 East Asia 8 Southeast Asia 16 North Europ 32 West Europe
You can find these exact references on VM Depot, each Image has a Deployment Script which will give you the right parameters for any Image, version, and datacenter. You can then directly create a VM :
azure vm create [vm-name] -o vmdepot-aa-bb-cc -l "location string" [username] [password] --ssh
This will create a new VM with the specified username and password, and will provision ssh access both in the VM and in the Windows Azure load balancer. The VM FQDN will be vm-name.cloudapp.net.
The azure create vm command has a lot of options allowing you to create a new VM from a system Disk, use a predefined Azure Storage Account (one is created on-the-fly when you use the previous sample code), and more. Help is available by typing azure --help ; to deprovision a VM, call
azure vm delete [vm-name]
This will retain the VHD as a System Disk. If you want to delete that as well, use the -b flag.
The Windows Azure load balancer only allows connections on port 22 by default (if you provided the --ssh flag when creating the VM). If you want to open other ports, you can use :
azure vm endpoint [vm-name] add [publicportnumber] [internalportnumber]
Details on the current debian Image
The current image has been created on 3 january 2012. It contains a minimal installation, plus any dependencies required by the waagent tool, plus the waagent tool itself. The image size is 10GB, but our first tests were on 2GB images and this is sufficient to host the system.
When you ssh into a VM created from this image, you'll see another disk (/mnt/resource). This is an ephemereal drive (it's physically attached to the VM and does not use Azure Storage). It has good performance, but its content is not persistent. Refer to the azure vm disk command to see how to create persistent data disks and attach them to a running VM.
Creation of a custom Image
We have explored three ways to create a new Image.
customisation of an existing image
This is the simplest technique : ssh into an existing VM where you have installed what you want to be in the final Image. The following command will put the machine in a de-provisioned state :
This command resets a number of parameters in the VM, and deletes the last created user account. This might not be sufficient to have the machine in a clean state, it's your responsability to determine other operations needed by what you installed (resetting history, deleting other accounts, and so on). Once this step is done, delete the VM, keeping its VHD:
azure vm delete vm-name
The resulting VHD (run azure vm disk list to get its url) can then be declared as an Image, and is also in the format expected by VM Depot if you want to share it. To create a personal Image (not shared), issue the following command :
azure vm image create [imagename] [systemDiskUrl] -o linux --blob-url [destinationImageUrl]
There are a number of ways to find the systemDiskUrl, you can for example issue the command
azure vm disk list --json
Creation of an Image from scratch, directly on Azure
This experimental procedure has been devised by Arnaud Patard. The basic steps are to create a blank data disk, attach it to a running VM, deploy the new distro on the Data disk, configure GRUB, then detach the disk and treat it as a System Disk.
Creation of an image using Hyper-V
This method requires you to have a Windows machine running hyper-v, and is detailed in the following documentation : Creating and uploading a Virtual Hard Disk that contains the Linux Operating System.