Taking advantage of Windows Azure Storage from PHP: example with a WordPress plugin

Continuing our efforts on improving interoperability between PHP and Microsoft technologies, we have created an example showcasing a new plugin for WordPress that allows WordPress developers to take advantage of the storage capacity of Windows Azure. This plugin enables WordPress to use Windows Azure Storage Service to host media for a WordPress-powered blog.

The plugin, developed by Microsoft, is now available as an open source project from the WordPress repository: http://wordpress.org/extend/plugins/windows-azure-storage/

About Windows Azure Storage and Content Delivery Network (CDN)

Windows Azure Storage enables applications to store and manipulate large objects and files in the cloud via blobs, manipulate service state via tables, and provide reliable delivery of messages using queues. You can read more about Windows Azure Storage here.

If you want to manage your media (images or any file offered for download) in a consistent way and share them across multiple websites then you might want to consider using Windows Azure Storage blobs. Windows Azure includes a service called Windows Azure Content Delivery Network (CDN) which offers developers a solution for delivering high-bandwidth content. Windows Azure CDN has currently 18 locations globally (United States, Europe, Asia, Australia and South America). Windows Azure CDN caches your Windows Azure blobs at strategically placed locations to provide maximum bandwidth for delivering your content to users. The benefit of using a CDN is better performance and experience for users who are farther from the source of the content stored in the Windows Azure Storage blobs. You can read more on the Windows Azure Team Blog and on MSDN

Windows Azure Storage from PHP with a WordPress plug-in.

The Windows Azure Storage plugin for WordPress allows developers running their own instance of WordPress to take advantage of the Windows Azure Storage services, including the Content Delivery Network (CDN) feature. It provides a consistent storage mechanism for WordPress Media in a scale-out architecture where the individual web servers don’t share a disk. Note that this scenario goes beyond WordPress and could also be very compelling any other web application where there’s a need to load balance across a number of web servers without shared disk.

The plugin is a regular WordPress plugin developed in PHP, and can be deployed on any WordPress instance (running on Windows or Linux - requires at least version 2.8.0 and tested up to version 2.8.4). The plugin uses the Windows Azure SDK for PHP to handle the interactions with Windows Azure.

Once the plugin is installed you’ll see it in the WordPress plugins management interface.

Once the plugin is activated and configured, which simply consists of setting your Windows Azure account information and a few options, you can use it directly through the blog post editor:

To include an image in the post, just click on the “Azure” icon. The following screen will pop up:

From here you simply pick the image you want to include.

When the plugin is installed, you can choose to have all media managed through the WordPress Media Management interface or during imports to also go to Windows Azure blob storage. Then it shows up in the regular list of media elements and not just under the Azure button.

Once you have published the post you can see that your image lives on Windows Azure Storage, although your WordPress applications can be hosted anywhere else.

Give it a try!

The plugin is now available from the WordPress repository: http://plugins.svn.wordpress.org/windows-azure-storage/. Register for your Windows Azure account (try for free till July 31, 2010 with the Introductory Special), install the plugin, and get started!

Feel free to share feedback!

Additional links

-- Jean-Christophe Cimetiere, Sr. Technical Evangelist , @openatmicrosoft