Cloud Zone is brought to you in partnership with:

After teaching math (and a little computer science) for 14 years, Brian changed careers in 2006 with the idea that getting out of his comfort zone would be good. So now he works as a writer and programmer at Microsoft who specializes in PHP and Windows Azure. Brian is a DZone MVB and is not an employee of DZone and has posted 82 posts at DZone. You can read more from them at their website. View Full User Profile

Using the Azure VM Depot

01.11.2013
| 2872 views |
  • submit to reddit

 

Yesterday, Microsoft Open Technologies announced a complementary service to Windows Azure VMs - the VM Depot. The depot is a community-driven catalog of open source VM images. This lets you create and share VMs with custom configurations or specific software stacks installed.

Doug Mahugh also posted a getting started article that gives the basics of using the service.

I spent some time working with the depot last night, and here are the things I learned.

Requirements

You can probably guess that you'll need a Windows Azure subscription, but there's a few more things you'll need to do.

  1. Make sure the VM preview feature is enabled for your service. You can do this by signing into your subscription and going to https://account.windowsazure.com/PreviewFeatures. Once here, sign up for the Virtual Machines & Virtual Networks option if it is not already active.

  2. Make sure you have the latest version of the Windows Azure Command-line tools, as the depot produces a deployment script that uses a newish parameter (-o). You can update the command line tools by doing one of the following:

    • Using the npm install azure-cli -g command to install the latest Azure command-line bits.

    OR
  3. You'll also need to import your account settings if you haven't already. You can find the steps for this in the How to download and import publish settings section of this article.

Using a community image

If you want to create a new VM using a community image, the process is pretty simple:

  1. Open http://vmdepot.msopentech.com/List/Index in your browser.

  2. Find an image you want from the list. You can either scroll through the list or use the search bar at the top. The following image illustrates using the search field to find a VM that has Riak.

  3. At this point you can either click the Deployment Script link to the far right of the VM entry you want to use or the Deployment Script icon at the top to retrieve a deployment script. You'll need to agree to the terms of use and select a region, and then you'll be given a command similar to the following:

    azure vm create DNS_PREFIX -o vmdepot-66-2-2 -l "East US" USER_NAME [PASSWORD] [--ssh] [other_options] 
  4. You will need to replace the fields such as USER_NAME with actual values. Here's what each should go in each of these fields:

    • DNS_PREFIX should be replaced with whatever you want this machine to be called. I'm going to use myawesomevm.

    • USER_NAME should be replaced with the user name you want to login to the machine as.

    • [PASSWORD] should be the password you want to use for this user (don't include the [] characters around the password).

    • [--ssh] should be changed to just --ssh if you want to enable SSH (and you probably do, otherwise how are you connecting to the machine?)

    • [other_options] should be replaced with any other options available for the azure vm create command. For example, --vm-size small.

    A final command line should look something like:

azure vm create larryriak -o vmdepot-66-2-2 -l "East US" larry secretpassword --ssh 
  1. Run this command from a command-line. It will copy the disk image from the VM Depot to storage in your subscription, and then provision a VM that uses this disk image.

  2. At this point, the new VM should show up in the Windows Azure portal.

    After the VM status changes to running, you should be able to use SSH to connect to the VM and use it as you normally would.

Publishing a VM

Doug Mahugh's article provides information on publishing an image to the VM Depot. I didn't go through the entire process of publishing a VM because I didn't want to clutter up the VM Depot with "Larry's great generic Linux VM for testing purposes". The steps seem relatively straight forward though.

Create a custom VM and publish a VHD to the VM Deopot

  1. Create a VM. You can find a walk through of this process in the Create a virtual machine running Linux tutorial.

  2. Once it's been created, SSH to the VM and install things people might find useful.

  3. Capture an image of the VM to a VHD. You can find these steps in the How to capture an image of a virtual machine running Linux article.

  4. Set the storage container that contains the .VHD to public. You can do this in the Windows Azure Portal by:

    1. Selecting the storage account.

    2. Selecting Containers.

    3. Selecting the container (vhds in this case) and clicking edit container. You'll get a dialog similar to the following:

    4. Select Public Container for the access level of this container, and then click the checkbox.

Publishing the VHD to the VM Depot

You'll need to create an account on the VM Depot for this step. It allows you to use a Windows LiveID, Google ID, or Yahoo! ID. To create an account, just click on the Sign In link in the upper right to set this up.

After you've created an account and signed in, perform the following steps to share your VM with the community:

  1. Click the Publish icon at the top of the page.

  2. Enter information about the VM image: name, description, what packages are installed, legal terms, etc.

  3. The URL of the VHD to publish is the full URL to the VHD in your public container. You can get this by performing the following steps:

    1. Go to the Windows Azure Portal.

    2. Go to the storage account that contains this VHD.

    3. Select Containers, and then select the container.

    4. A list of the objects in the container, along with the full URL to each item, will be displayed. Just note the URL and use it in the URL of the VHD to publish field in the VM Depot.

  4. Once you've specified the VHD path and filled out all the information, agree to the terms and click the publish button.

Final Thoughts

The VM Depot is a great addition to the Windows Azure VM story. Previously you had to select a raw OS image and manually install your software stack on it. With the Depot, you can now pick an image that already has the stack you need, as well as share your custom stack with the community. And since it's based on the Windows Azure command-line tools, it allows you to create the command-line once in the portal and then use it in your automation scripts, or hand it out to co-workers who need to create their own VMs.

There's already a lot of VMs in the Depot for both specific OS releases (Debian Wheezy and Mageia) and specific software and software stacks (LAMP, Ruby, JRuby, WordPress, Joomla, Drupal). It will be interesting to see what new VMs show up now that this is open to the community.

Any thoughts on specific OS or software stacks that you'd like to see in the VM Depot?



Published at DZone with permission of Brian Swan, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)