June 7, 2012 update: The Microsoft Windows Azure team has released a new Windows Azure SDK for PHP. This release is part of an effort to keep PHP client libraries up to date with new Windows Azure features and to make PHP a first-class citizen in Windows Azure. The latest client libraries are on GitHub: https://github.com/WindowsAzure/azure-sdk-for-php. While the SDK hosted on CodePlex will continue to work for the foreseeable future, it is strongly recommended that new PHP/Windows Azure application use the SDK hosted on GitHub.
The work done by Maarten Balliauw and other contributors in building the SDK hosted on CodePlex was critical in unifying the PHP developer experience for Windows Azure. The Windows Azure team is grateful to these contributors for their pioneering work and looks forward to their continued support (and yours!) in adding to the new SDK on GitHub.
The Windows Azure Team
Last week I wrote a couple of posts (here and here) about the command line tools in the Windows Azure SDK for PHP. And, as I pointed out in the latter of those posts, I found it necessary to extend the functionality of the command line tools. After a bit of reflection, I started wondering two things:
- Would others find my extension to the command line tools useful? If yes, is my design for the extension useful. Is it designed in a way that you would expect?
- More broadly, how do developers envision using the command line tools? I have ideas about scenarios where the tools are useful, but I’m just one person.
So, in this post, I’ll share a bit more detail about the work I’ve done in extending the command line tools in hopes of stimulating some discussion around the questions above. (BTW, I've submitted the code for the functionality below as a patch for the Windows Azure SDK for PHP. Hopefully, my patch will be accepted soon. EDIT: My patch has been accepted to the SDK, so the functionality described below is now available!)
In a nutshell, I added 3 operations to the deployment command line tool:
- getRoleInstances: Returns the number of instances that are running for a specified deployment as well as the name and status for each instance.
- getRoleInstanceProperties: Returns the status, upgrade domain, fault domain, and size of a specified instance.
- getRoleInstanceProperty: Returns the role name, status, upgrade domain, fault domain, or size of a specified instance by instance name and property name.
Note: All the information I’m surfacing in these operations is already available via the PHP API of the Windows Azure SDK, it just wasn’t accessible via the command line.
Here’s how these operations are used and example outputs:
Example command (getting role instances by specifying the deployment slot – production or staging):
You can get the same information by specifying a deployment by name (instead of by “slot”, as shown above)
Example command (getting role instance properties for a specified deployment and specified instance):
You can get the same information by specifying a deployment by name (instead of by “slot”, as shown).
Again, you can also specify the deployment by name instead of by “slot”.
So, what good are these new operators? Well, at the risk of showing my inexperience with batch scripts, now you can write a script that will create a service, deploy a package, and return when all instances are running:
Of course, that is just one possibility. You can now write scripts that become the tools for easily deploying and managing your Azure deployments. Which brings me back to my original questions: Basically, does this seem useful?