MS Open Tech releases updated Azure Node.JS SDK and Command Line Tools for Mac and Linux

More news for our Linux friends deploying virtual machines to the cloud. Today at Microsoft Open Technologies, Inc. (MS Open Tech), we’d like to share an update to the Node SDK and Command Line tool for Mac and Linux, offering support for virtual networks, endpoints and more. This tool helps developers and IT admins to deploy and manage Linux (and Windows) virtual machines on Windows Azure.

We’ve received lots of feedback on the Windows Azure command line tool for Mac and Linux since our team at MS Open Tech released project last year. As a result, we’re now updating the tools by adding several commonly requested features, including:

  • Virtual network configuration
  • Improved billing management for stopped VMs
  • Endpoint management
  • Load Balanced Endpoint update

Following is a summary of the new features. As usual, send us a pull request if you’d like to contribute to these tools, or leave a comment/email if you have some feedback for us.

1. Virtual Networks

Since Virtual Networks have been added to the Windows Azure REST API, we added support for this feature to both the Azure SDK for Node.js and in the Command Line tool for Mac and Linux:

In order to support virtual networks we’ve contributed a new API to the Windows Azure SDK for Node.JS that enables configuration of Virtual Networks. This API can be used standalone in Node.JS apps for configuring VNETs.

For example, the following sample node.js code demonstrates how to configure a VNET by using the service management API.

var service = azure.createServiceManagementService(

      subscriptionId, auth,

      { serializetype : 'XML'});

var vnetObject = {

  VirtualNetworkConfiguration : {

    VirtualNetworkSites : [

      {

        Name : 'test',

        AffinityGroup : 'test-ag',

        AddressSpace : ['10.0.0.0/20'],

        Subnets : [

          {

            Name : 'sub1',

            AddressPrefix : '10.0.0.0/23'

          }

        ]

      }

    ]

  }

};

service.setNetworkConfig(vnetObject, function (err, response) {

// handle errors / process the result

});

Refer to our full documentation on GitHub for complete details of ‘VirtualNetworkConfiguration’ object model.

This SDK also provides the foundational pieces for the Command Line Tools. This makes it possible for admins to use same functionality via our Command Line Tool. Here is a sample usage showing how to create a Virtual Network in your subscription, with default settings.

$ azure network vnet create vnet1 --location "West US" -v

info: Executing command network vnet create

info: Using default address space start IP: 10.0.0.0

info: Using default address space cidr: 8

info: Using default subnet start IP: 10.0.0.0

info: Using default subnet cidr: 11

verbose: Address Space [Starting IP/CIDR (Max VM Count)]: 10.0.0.0/8 (16777216)

verbose: Subnet [Starting IP/CIDR (Max VM Count)]: 10.0.0.0/11 (2097152)

verbose: Fetching Network Configuration

verbose: Fetching or creating affinity group

verbose: Fetching Affinity Groups

verbose: Fetching Locations

verbose: Creating new affinity group AG1

info: Using affinity group AG1

verbose: Updating Network Configuration

info: network vnet create command OK

For more information please refer to our wiki page for a full list of commands to manage Virtual Networks on Windows Azure.

2. VM Stop Billing Feature

In the first release of the Windows Azure infrastructure services, Windows Azure kept a reserved deployment spot for every stopped VM in the compute clusters, and continued to bill the user for VM compute resource unless user explicitly deleted the deployment. This changed, and now Windows Azure no longer charges users compute time for any stopped VMs. However, it still preserves the deployment state and configuration.

MS Open Tech updated the Windows Azure SDK for Node.js and Windows Azure Command Line tool for Node.js to support this scenario. Consequently, when a VM is stopped using the azure vm shutdown command, the account will no longer be billed. Note that IP address of the VM with state StoppedDeallocated (i.e. stopped and not billed) will be released, and there is not guarantee that restarting the VM will result in the same IP being allocated.

If you need your VM to stay allocated and preserve the IP address, we offer the --stay-provisioned switch for the azure vm shutdown command. Note, however, that in this case your account will continue to be charged for the compute time.

3. Endpoint Update

We have added a new command which allows users to change load balancer port, virtual machine port, end point name and protocol associated with an existing endpoint. The usage and options are listed below. For more information, read the article Load Balancing Virtual Machinesin the Windows Azure Documentation.

$ azure vm endpoint update --help

help: Update a VM endpoint

help:

help: Usage: vm endpoint update [options] <vm-name> <endpoint-name>

help:

help: Options:

help: -h, --help output usage information

help: -v, --verbose use verbose output

help: --json use json output

help: -d, --dns-name <name> only consider VM for this DNS name

help: -n, --endpoint-name <name> the new endpoint name

help: -t, --lb-port <port> the new load balancer port

help: -t, --vm-port <port> the new local port port

help: -o, --endpoint-protocol <protocol> the new transport layer protocol for port (tcp or udp)

help: -s, --subscription <id> the subscription id

4. Load Balanced Endpoint Update

One of the cool new features in Windows Azure is updating load balanced sets:

Let’s suppose you create two virtual machines ‘vm-1’ and ‘vm-2’ under the same cloud service ‘my service’ and added a load balanced endpoint ‘lbset1’ to both VMs. The new Windows Azure API will allow user to update the load balanced set ‘lbset1’ (for example change the probe protocol) so that it will be applied to all VM roles with this load balanced set endpoint defined.

To support this new Azure functionality, we have added a new API updateLoadBalancedEndpointSet to the Windows Azure SDK for Node.JS and we will be also adding command line tool support soon (this wiki contains a list of all the proposed LB set commands)

5. Other Improvements

Finally, we made a couple more updates to the vm create command such as adding the ability to use any user name when creating Windows VMs (in the past one had to use ‘Administrator’), and displaying the image copy progress while using --community option. In addition there are a number of “under the hood” changes such as early failure in the face of common problems and more informative error reporting. These features make the tool easier to use in a variety of situations.

Getting the Node.js SDK for Windows Azure

The Node.js SDK and CLI make it easy to work with Windows Azure from within your own applications or from the command line. If you already have a version of the node.js tools all you need to do it run npm update azure-cli -g. If you are new to the tools then you have a couple of simple setup steps to follow, these are fully documented on the VM Depot help site. Since we mentioned VM Depot it might be worth reminding you that VM Depot has over 700 pre-configured virtual machine images ready for deployment, using the CLI, to Windows Azure.