Category Archives: Azure

Easy Setup for PHP On Azure Development

I just got back from the JumpIn Camp in fantastic Zurich, Switzerland. I’ll blog about that whole experience shortly. In the meantime, however, I thought I’d get some resources out here that would have been useful last week. 🙂 Specifically in this post, I thought I’d tackle the Windows Azure 4 Eclipse tooling setup.

There are two major things that we need to do. First is to get the Windows Azure SDK installed. The reality is that this is all that you *really* need to do Windows Azure development and testing. However, we want to do our PHP development with the Eclipse toolset for Azure. This gives us debugging support and a lot of great helpers.

Installing the Windows Azure 1.1 February 2010 SDK

First, we need to get the requirements for the Windows Azure 1.1 February SDK itself installed.

To get started, we need to have Windows Vista with Service Pack 1 or later. Really, I recommend that you go with Windows 7 if you have to upgrade.

Enabling ASP.NET and CGI in Windows Features The next thing that you need is to enable IIS with ASP.NET and CGI support. This is easier than it might seem. In the Control Panel, find “Turn Windows Features on or off”. On Vista, you might have to open Add/Remove Programs to find that option. Here, you need to navigate down the tree and find Internet Information Services | World Wide Web Service | Application Development Features and enable ASP.NET and CGI. That will auto select the other dependencies such as .NET Extensibility and ISAPI Extensions and Filters.

Once you complete that, you need to install some version of SQL Server 2005 or later. The one that I recommend, if you don’t have SQL Server already installed is Microsoft SQL Server 2008 Express.

Those are all of requirements the Windows Azure 1.1 February 2010 SDK. At this point we can download and install it.

Installing Eclipse with the Windows Azure for Eclipse tooling

The next step is to install Eclipse itself. Eclipse is written in Java so you will need the Java JRE 5 or later. 5 is no longer supported so I recommend that you go with Java JRE Standard Edition Version 6.

Once that’s installed, it’s a simple matter of downloading the PDT 2.1 All In Ones / Eclipse PHP Package and unzipping it into a folder. The PDT version of Eclipse comes with a lot of tools for PHP including perspectives for PHP, the Zend debugger, XDebug, syntax highlighting and more. The Windows Azure 4 Eclipse tooling builds on this.

Now, you need to install the Windows Azure 4 Eclipse tooling. To do that, open Eclipse and select Help | Install New Software. Click “Add” and put in Windows Azure For Eclipse for the title and for the location. In the tree below, select all three pieces and follow the rest of the wizard.


This installs the Windows Azure for PHP SDK and a lot of tooling inside of Eclipse to get you set up.

At this point, you are technically ready to go but I recommend doing a few more things.

Quick Tips to Make Things Smoother

There are a number of little things that we discovered throughout the week that will make things easier for you.

PHP Version Conflicts

The first thing to do is to check to see if you’re going to have any conflicts between the version of PHP on your disk and the version of PHP that comes with the Eclipse tooling. The conflict is that even if both versions are PHP 5.2.13, the version that Eclipse uses is the thread-safe version and the one that everyone else in the world uses is the non-thread-safe version because most people don’t do threading in PHP anyways (I know you do Liz Smith but you’re not most people…). This happens if you’ve used the PHP Installer or the Web Platform Installer to get PHP on your box because both of them put PHP in the %Path% which is the right thing to do. The issue comes in when the Azure DevFabric starts PHP-CGI.exe from your Azure install but that executable looks in the path for it’s dependencies. It finds the non-thread-safe libraries and throws an exception. Oops.

*update* I had a much better idea than the below – check out my new post on resolving the PHP Version conflicts at Resolving PHP Version Conflicts While Developing For Azure”

There are a couple of fixes that you could leverage, none of which are ideal. One is to just install the thread-safe version on your box. There are two issues here. First is that you are now using the thread-safe version of PHP on your own box and it might not be that one in the cloud. The second issue is that you are using your php.ini file from the c:\Program Files (x86)\PHP\ folder. This is not really an issue if you remember this fact and make sure that you deploy that PHP.ini file and set of extensions that you want to deploy.

The other fix, the one that I’ve chosen to do most of the time, is to simply rename the PHP directory on my disk (typically at c:\Program Files\PHP or c:\Program Files (x86)\PHP) when I’m doing Azure development and rename it back when I want to do local development. This is a little bit of a pain sometimes but it’s easier to find these issues than the subtle ones that could be introduced by the other technique.

Resolving the mystery 500 Error

Unfortunately, there’s not a great way to divine what is causing the 500 error in some cases. The one that I see most often is the PHP version conflict. Others include database connection errors, file permissions issues, uncaught exceptions and the like. There are two ways to handle this.

The first is to make heavy use of the logging facilities to write out to the dev fabric manager’s UI the exception.

The second way is to attach either the Zend debugger or XDebug to the Dev Fabric and step through the issue. The way to do that is to

Zend Debugger and Windows Azure DevFabric Storage

Changing the Zend Debugging PortThe first thing is that the Windows Azure DevFabric Storage uses port 10000. This is not a bad thing except that the Zend Debugger, by default, also uses port 10000. The end result is if you launch Eclipse and then try to start the development fabric storage engine, you’ll get a conflict.

Specifically, the error is from the Development Storage engine – “The process cannot access the file because it is being used by another process”. This is a bizarre error that doesn’t actually give you correct information. The way to fix this is in Eclipse, go to Windows | Preferences, find the Zend Debugger settings and edit the port.

Download Windows Azure for PHP Contrib Project

There are a couple of things that are not in the Windows Azure for PHP SDK. A couple of specific examples are Azure Drives, editing the PHP.ini and more. That’s all found in the Windows Azure for PHP Contrib project by Maarten Balliauw. Fun story on this is that at JumpIn Camp Maarten looked over at me and asked me if there was a way to mount Azure drives in PHP. I said that I didn’t think so. 20 minutes later, he called me over to show me that he had gotten it working. He spent another 20 minutes cleaning it up and committed his patch to the Windows Azure for PHP Contrib

Creating a Hello World Azure Application with Eclipse

Select Windows Azure Web Project This has walked you through the setup of the Windows Azure 4 Eclipse tooling and now you’re ready to get started with your first Azure application to test the install and all.

To test the install, click File | New | Project. In the New Project Wizard, expand the tree to find PHP | Windows Azure Web Project.

Click Next.

PHP Azure Project WizardIn the PHP Azure Project, name the project Hello World and select the Windows Azure Data Storage option.

Click Finish.

This will create the project and give you some starter code that you can work with. To do that, select the project in the PHP Explorer and select from the menu Windows Azure | Run in Development Fabric. This will package the application and then launch it in the DevFabric. If it’s not running, it will give you the user access control admin permissions screen twice, once for the DevFabric Compute and once for the DevFabric Storage.

PHP InfoNext will launch the browser and navigate to your application running in the DevFabric. The simple Hello World show PHPInfo().

Soon, I’ll post about writing a slightly more complex application.

Please use the comments on this post to let me know if you were successful or not in getting the PHPInfo() to show…

PHP On Azure Resources

I’m at JumpIn Camp in Zurich and we’ve been diving deep into PHP on Azure. One of the things that we’ve done is talk about a ton of resources that are available out there on the web to learn more about PHP on Azure. To that end, I thought I’d collect a few of them here on my blog.

In the morning, I talked at a high level about what Azure is, how the various roles work and how to run PHP on Azure. My deck that I used was the first half of the same deck that I used on the PHP On Azure World Tour.

Another great starting point and set of resources is Maarten Balliauw’s Blog itself. He’s been helping out here at JumpIn Camp from a technical perspective on Azure and running PHP on Windows in the first place. He did the next part of the session diving deep into the PHP on Azure SDK.

You’ll notice some overlap between our desk because we’re largely talking about the same SDK and leveraging the same code examples.

Maarten’s first deck that he used to talk about Blog, Queue and Table storage is:

The second one that Maarten used to talk about SQL Azure is:

Maarten also did a demo of an app called ImageCloud leverages both a Web and Worker role to do front end uploading of an image and backend processing of that image. That code can be found at ImageCloud Azure Demo Application.

For some great resources on architecture guidance, take a look at Windows Azure Architecture Guidance. This is put out by the Patterns and Practices group at Microsoft.


Another great resource is Benchmarking and Guidance for Windows Azure. This was created and launched by the Extreme Computing Group (aka XCG).


More resources:

Microsoft Windows Azure Interop

Microsoft Interop Bridges

Windows Azure 4 Eclipse


Windows Azure MySQL PHP Solution Accelerator


I’ll be adding to these resources over the course of the week so check back for lots more.

PHP on Azure World Tour

IMG_2837I have the privilege and honor of doing a tour of across Europe talking to PHP developers about running on Azure and on IIS. The countries that I ended up in are Ireland, Portugal, Austria, UK, Norway, The Netherlands, Belgium and then I went back to Ireland. That included 2 conferences and 6 Microsoft run events.

The way that the trip came about is that I was invited to keynote PHPUK 2010 and since I was going to be in Europe already, Beat Schwegler organized for me to visit the other countries. Big thanks out to him for organizing the whole trip.

The topic in at the Microsoft run events was “Scaling Big While Sleeping Well” which is a talk about PHP on Azure.

Dublin, Ireland (First time around)

Ireland was the first place that I did my Azure session. There were roughly 20 people in the audience.

Lisbon, Portugal

IMG_1966One of my regrets about the whole trip was that I didn’t get to spend as much time in each of the countries as I would like to have. Portugal was definitely one of them that I was disappointed that I didn’t get to spend more time in. I was on the ground for about 18 hours from 10:30 on Monday night to about 2:00 on Tuesday.

On the plus side, we had quite a few people in the audience and they were engaged. I had a ton of good questions and hopefully I answered them all. Also, it was a fantastic venue. It was in the new library building for one of the local colleges – Faculdade Nova de Lisbon. The venue was a real tribute to the college as it was a gorgeous facility and the room was almost acoustically perfect.

Vienna, Austria

IMG_2000This was my first time in Austria. My brother and sister both have done college studies in Austria so told me lots of different things to do while I was there. I was a little disappointed in the turn out at this event as it was only about 7 people there including Rolf Mistelbacher and Gerhard Goeschl from Microsoft.

Another cool thing in Vienna was that I got to catch up with an old friend Andreas Erlacher who showed me around downtown Vienna.

PHPUK 2010 in London, UK


One of the extremely cool things that I got to do is keynote at PHPUK 2010. I did my Lost Art of Simplicity talk as an uncon session at ZendCon. Scott MacVicor heard about it and was kind enough to pitch it to the board of the conference. The session went over really well and got a lot of great feedback on – in fact it’s currently the most reviewed talk on 🙂 Considering that there were roughly 450 people in the audience and 500 at the overall event, it makes a lot of sense.

I want to thank Johanna Cherry, Matt Raines and the rest of the organizing committee for their organization and hospitality.

image Since I was doing the keynote, it didn’t really make sense for me to do another session as well. Rob Allen, however, stepped up big and did a session on Azure. Turns out that he had not looked at Azure prior to Will Coleman and I asking him if he’d be interested in doing the talk. Not only did he say yes, he did a fantastic job as well. I was also pleasantly surprised that there 52 people in the room to hear about Azure.

You can download Rob Allen’s Azure Slides.

Oslo, Norway

IMG_2825This was the first time that I had been to Norway. I got really lucky with the weather. Evidently the week before I was there it was –18 Celsius but it was –4 (roughly 25 Fahrenheit) which is actually a lot like how I left Michigan.

There were 12 people in the audience + Rune Zakariassen who was gracious enough to host me for the day. I also had a chance to meet with Petter Merok, the Developer and Platform Evangelism lead for Norway.

Amsterdam, Netherlands

IMG_2873I’ve been through Schiphol in Amsterdam a lot of times but not really gotten to spend much time outside of the airport itself. Also, it was fantastic to have a great guide around Amsterdam in Juliette Folmer.

The session itself was a joint meeting hosted by Microsoft and PHP Benelux. PHP Benelux is a cooperation of the Netherlands, Belgium and Luxemburg PHP user groups. Big thanks to Stefan Koopmanschap aka @skoop and Bram Veenhof for organizing in the Netherlands. There were two presentations. First was Jan-Willem Eshuis from NOS. NOS is a public broadcast network in the Netherlands that manages all of the sports broadcasting in the country. He talked about Service Oriented Architecture and how NOS has been able to reach the scale that they have. It was a lot of fun talking with him about how they were managing and broadcasting the Olympic coverage. The second presentation was mine. It was a small group, 5 people, but they were very engaged and I almost didn’t make it through the materials…

Brussels, Belgium

IMG_2999I met with the Belgium branch of the PHP Benelux user group the next day in Brussels. This was another small but great meeting.

As with the previous meeting, there were two sessions. The first session was by Michelangelo van Dam aka @dragonbe. He took one of the Zend Framework sample applications and ported it from Linux to Windows showing how easy this process can be. This was cool because it gave between the two of us we were able to point out the power of the web.config from showing off simple configuration and setting up the FastCGI handler to showing the URL Redirect bits.

Next I talked about Azure. Here I got my my personal favorite compliment of the whole trip. It came from a hoster who came in hoping that he wouldn’t like Azure as it’s in direct competition with his business. He begrudgingly told me after the meeting that he was impressed and liked what he had seen. 🙂

Big thanks to Katrien de Grave for hosting me all day and organizing the meeting. It was also great to get to finally meet her after thousands of emails back and forth on various topics.

WordCamp Ireland in Kilkenny, Ireland

I wrapped up my tour by hitting WordCamp Ireland in Kilkenny, Ireland. Read all about that in my post about WordCamp Ireland.


I had a ton of fun on my tour even though it exhausted me completely.

PHP/Ruby on Azure World Tour

I’m thrilled and honored to be doing another speaking tour through Europe. I’m getting to visit a number of countries that I haven’t visited before and some old favorites. I’ll be speaking on PHP, Ruby and other non .NET technologies on Azure.

The talk that I’m going to be doing in most places is PHP/Ruby on Azure or Leveraging Azure with Non-Microsoft Languages:

Windows Azure is Microsoft’s Cloud Computing offering. It is more than a simple scalable hosting option as it is truly a platform as a service offering. This allows you to focus on your application rather than the configuring and managing your infrastructure whether you are writing C# or VB.NET or even languages such as PHP or Ruby which are first class citizens in Windows Azure. The Windows Azure Platform includes Windows Azure, which is the OS and hosting environment for web and background services, as well as non-relational storage, queues, and a blob storage for everything from videos to mountable virtual drives. Additionally, the Windows Azure Platform includes SQL Azure, a fully relational database as a service, and Windows Azure AppFabric for industry standards compliant identity management and a service bus for message passing.

But there remain the questions around why, when and how you should move to the cloud, especially if you are using PHP or Ruby. Should I put everything in Windows Azure? Do you have to convert everything you have to ASP.NET? Do you have to write code specifically for Windows Azure? What if my current applications depend on MySQL and/or memcached?

There’s a lot of good news here as it is relatively straight forward to get running in Windows Azure. Once your application is running, however, now you need to look at how to fully leverage the platform offerings architecting for the best usage of the different roles and the various aspects of the Windows Azure offerings such as the AppFabric and SQL Azure. This will help your application make the most efficient usage of CPU, bandwidth, storage and all of the things that cost in a cloud hosting scenario.

In this half day session, we will begin with the why of Windows Azure talking about when it makes sense to make a move and what the prudent migration paths are for your organization.  During this time we will tour the various aspects of Windows Azure. Then we’ll delve into the technical aspects of how to run your PHP/Ruby code on Windows Azure. Once we have that mastered, we will move onto leveraging the Windows Azure platform to its fullest.

The full schedule is as follows (and yes, this is a lot of countries in not very many days)

Feb. 21 – Dublin Ireland –

I love Ireland. I hope to someday live there. I spoke there about a year and a half ago on RIA and got to meet a few of the folk but mostly worked with Martha Rotter. I got to make a number of friends last time and I’m really looking forward to seeing them again.  

Feb 23 – Lisbon, Portugal – 

This is my first time to Portugal. I’m really looking forward to meeting the local DPE team (Luis Alves Martins and Sergio Martinho). I’m speaking at the university. it looks like a beautiful venue – I just wish that I had more time here to explore the local culture.

Feb 24 – Vienna, Austria – 

My brother has spent a lot of time in Austria but I’ve never been. I have met Mario Szpuszta back when he and I both spoke at JAOO in 2008 in Denmark. That was an awesome conference. I’ll also get to met Rolf Mistelbacher. Another thing I’m really excited about is that I’m going to spend enough time to actually see some of the city.

Feb 26 – London, UK – Keynoting PHPUK –

At PHP UK, I’m actually not talking about Azure. Rather I’m doing a keynote titled The Lost Art of Simplicity (Full slides on slideshare). This is actually the original reason that I’m coming to Europe in the first place. I’m honored to be asked to do the keynote and am beholden to Scott MacVicar for the invitation and to Johanna Cherry for making everything work smoothly.

March 2 – Stockholm, Sweden –

Check out this awesome venue – – it’s a 17th century building in downtown Stockholm. Really looking forward to hanging out in this space.

March 3 – Oslo, Norway – registration information coming soon

I’ve never been to Norway. I should have more information about this trip in the next day or so and I’ll update this post.


I’ve got all of the registration information for my Oslo stop.

Auditorium (ground floor)

Lysaker Torg 45

Lysaker Akershus 1366

Norge for all of the registration information.

Also, as a side note I’ve met a bunch of people from Norway while at the PHPUK conference and they’ve assured me that the polar plunge was decent training for my visit but I’d enjoy it regardless.

March 4 – Amsterdam, The Netherlands – PHP User Group

I haven’t actually met Bram Veenhof in person but  have been working with him over the past couple of years on a couple of things.I’ve been to Amsterdam several times but mostly just to the Airport and the Microsoft offices there, both of which are awesome. I’m thrilled this time to actually have a little time to explore the city.

March 5 – Brussels, Belgium –

I’ve been to Brussels once before and I’m really looking forward to going back. I’ve not get Katrien De Graeve and Rudy Van Hoe but are two of the other people that I’ve been working with closely over the past couple of years.

March 6,7 – Kilkenny, Ireland – hanging out and speaking at Wordcamp Ireland

Again, I love Ireland and hope to live there someday. I’ll be in Kilkenny at Wordcamp Ireland.

It’s going to be a lot of fun and I’m really hoping that there’s lots of good conversation. Please let me know via comments or via twitter if you’re able to make it to one of the sessions.

If you tweet about this – please use the hash tag #phpazuretour and #cityyourecomingto!

Hello World Azure in PHP

Building on the Windows Azure Command Line Tools blog post, I thought we could kick it up a notch and get PHP running in Azure leveraging the command line tools. The primary thing that we need to do is to copy the PHP bits up with the rest of your deployment and configure the FastCGI handler to know where the PHP interpreter can be found.

If you have PHP installed, locate your directory. Otherwise, download one of the versions from I haven’t personally tested it with every possibly distribution but it should work with all of them up there.

To get started, setup a simple folder structure as before but with the addition of a folder called PHP:


Now copy the contents of the PHP download or your PHP install to the php folder.

Now add a file called index.php to the WebRole directory:

<head><title>Hello World PHP</title></head>

echo 'Today is '. date('Y-m-d') ."\n";


The one other actual difference between the HTML version and the PHP version of this little hello world sample is that you need to add one more file to the WebRole directory called web.roleconfig.

<?xml version="1.0" encoding="utf-8" ?>
      <application fullPath="%RoleRoot%\approot\php\php-cgi.exe" />

On your own IIS server you would call this the web.config but in Azure, it’s called the web.roleconfig.

Now, just like in the other sample you need to set up your Config and Definition files.


<?xml version="1.0" encoding="utf-8"?>
<ServiceDefinition name="Simple" xmlns="">
  <WebRole name="WebRole" enableNativeCodeExecution="true">
      <!-- Must use port 80 for http and port 443 for https when running in the cloud -->
      <InputEndpoint name="HttpIn" protocol="http" port="80" />


<?xml version="1.0"?>
<ServiceConfiguration serviceName="Simple" xmlns="">
  <Role name="WebRole">
    <Instances count="1"/>

Package everything up with cspack.

c:\Project>cspack simple.csdef /copyonly
Windows(R) Azure(TM) Packaging Tool version
for Microsoft(R) .NET Framework 3.5
Copyright (c) Microsoft Corporation. All rights reserved.

And run in the dev fabric with csrun.

c:\Project>csrun simple.csx simple.cscfg
Windows(R) Azure(TM) Desktop Execution Tool version
for Microsoft(R) .NET Framework 3.5
Copyright (c) Microsoft Corporation. All rights reserved.

Using session id 1
Created deployment(31)
Started deployment(31)
Deployment input endpoint HttpIn of role WebRole at

Now you are ready to run and test


And that’s all that there really is to getting PHP running in Azure. Soon I’ll blog about getting a full blown app running in Azure. Stay tuned.

Getting MySql Running on Azure

azure[1] There are a few applications that I’m playing with in Windows Azure that are reliant on MySql for various reason. For example, I’m working with a group that is doing Joomla development and it’s completely dependent on MySql. Mostly this is due to using MySql native drivers rather than using a database independent layer such as ADO.NET in .NET or PDO in PHP or leveraging database specific features that are only found in MySql. Regardless of the reason, for me to run these applications in Windows Azure, I have to get MySql running in Azure. I found that it wasn’t as hard as I initially thought it would be and it’s a technique that I can reuse for a lot of binary executables.

Thoughts and Recommendations

Before I go into the technical details of getting MySql working, I thought I should share what I think of running MySql in Windows Azure to save you the time of reading through all of this before I try to talk you out of it.

The reality is that even though you can run MySql in Windows Azure, it’s not overly practical to do so. My recommendation is to use this as a last resort or stopgap until Sql Server support for your application is ready to go. There are multiple reasons why this is my recommendation, some technical, some financial. None of them have to do with MySql itself but rather the process that you have to go through to run and manage it in Windows Azure.

First, let’s dig into the technical. The way that hosting MySql in Windows Azure working is that you create a worker role that will actually host the binary. You have to copy up the executable and then have just a little bit of Windows Azure specific code to actually execute the application and pipe requests to it. You can actually do that with just about any type of executable as long as it can be XCopy deployed and run headless. This could be especially good for things like doing distributed calculations.

With regards to mySql, however, one issue that I see with this is that you have to pay $0.12 an hour per web role that you have live which means that on average (at 0.12 * 24 * 30) you’re paying $86.40 a month for a single instance of MySql. That’s prior to having any type of failover or durability. SqlAzure is only $9.99 a month for a gig of storage.

If you want failover and durability, you need to run at least one extra instance of MySql in another worker role and configure them in a master/slave configuration. The reality is that you can get some fairly high durability with this configuration and it’s out of the box part of the Windows Azure MySQL PHP Solution Accelerator that we’re going to download in a moment.

Now, if you want to manage the MySql instances, you’ve got a couple of options. One of those is to run PHPMyAdmin which runs in a web role. Or you can connect to your MySql databases with a remote admin tool of some sort. Contrast that to being able to log into the Windows Azure admin page and administer your SQL Azure databases.

Getting MySql Running on Azure

Now that I’ve convinced you not to do this unless you absolutely have to, let’s dig into the technical steps of getting MySql running.

There’s a PDC talk that covers some of this material at Developing PHP and MySQL Applications with Windows Azure..

First, I wanted to get MySql running in Windows Azure.

  1. First, I downloaded the Windows Azure MySQL PHP Solution Accelerator. There’s a manual for that accelerator that lays out the rest of the requirements for getting MySql running in Windows Azure.
  2. The first requirement is MySql itself. I downloaded the XCopy deploy version of MySQL (
  3. Next, since we are going to use PHPMyAdmin to administer the MySql databases, I downloaded PHP –
  4. And then, obviously, PHPMyAdmin –

Now that I had the basic requirements down for MySql running in Azure, there are a couple of steps that I had to take.

First, I installed the Windows Azure MySQL PHP Solution Accelerator and extracted MySql, PHP and PHPMyAdmin.

Then I ran the “Buildme.cmd” script that comes with the accelerator. That checked to see if the MySQL binaries were in the right place. Since I hadn’t done anything other than download and unzip MySQL, the Buildme.cmd script fixed that for me and copied them to the right directory (.\MySql_WorkerRole\mysql). BTW, this could take a little while. Then it asked me for the

Next thing is to open up the .\, I renamed php.ini-recommended to be php.ini and did a few edits.

  1. Change the extension_dir to be as follow:
    • extension_dir = “./ext”
  2. Uncomment (remove the ; from in front of the following:
    • extension=php_mbstring.dll
    • extension=php_mcrypt.dll
    • extension=php_mysql.dll

Second, I extracted PHPMyAdmin to a holding directory and made a few edits to /libraries/config.default.php.

  1. Search for ‘auth_type’ and ensure that it’s as follow:
    • $cfg[‘Servers’][$i][‘auth_type’] = ‘cookie’;
  2. Search for ‘AllowArbitraryServer’ and ensure that it’s as follows:
    • $cfg[‘AllowArbitraryServer’] = true;

Now that those edits are done we are almost ready to try running the MySql portion of this exercise in the DevFabric.  Last this is that I *highly* recommend changing the username/password from mysqluser/#ms123 to something else. Now we’re ready to test.

Before we do that, let’s take a quick peek at what the solution accelerator comes with.

First, there are 4 projects that are (or at least can be) deployed and a couple of helper folders.

  • MySql_WorkerRole – this is the primary application that we’re concerned about as it is the one that deploys MySql for us.
    • MySqlPHP – Windows Azure configuration bits for the projects
  • PHPMyAdminWebRole – this role packages up PHPMyAdmin and runs it in Azure.
  • InstanceManagerClient – this is an admin application that you can use to get command line access to the worker roles running MySql. This can be very useful for a lot of reasons. It connects to the InstanceManagerServer
    • InstanceManagerServer – this runs in each of the MySql_WorkerRole instances listening for connections from the InstanceManagerClient.
  • WorkerRole – Logging and maintenance worker role
  • Roles.Common – helper project
  • Test.Common – test project

Really, for this exercise we just care about the top three of those projects.

In the config project is the ServiceConfiguration.cscfg which has a worker role configured for MySql:

<?xml version="1.0"?>
<ServiceConfiguration . . .>
  <Role name="MySql_WorkerRole">
    <Instances count="3" />
      <!--<Setting name="DataConnectionString" value="UseDevelopmentStorage=true" />-->
      <Setting name="TableStorageEndpoint" value="" />
      <Setting name="BlobStorageEndpoint" value="" />
      <Setting name="DataConnectionString" value="DefaultEndpointsProtocol=https;AccountName=azuresolaccstorage;AccountKey=yQai0qLjF7lUTPy3pcf+j2xyjAKQnf7nCv2IYMIPPBWsqkGiOZqD/KMb9aolc9/kh41pm6XB5Zt0boBje7MXlg==" />
      <Setting name="DiagnosticsConnectionString" value="DefaultEndpointsProtocol=https;AccountName=azuresolaccstorage;AccountKey=yQai0qLjF7lUTPy3pcf+j2xyjAKQnf7nCv2IYMIPPBWsqkGiOZqD/KMb9aolc9/kh41pm6XB5Zt0boBje7MXlg==" />
      <Setting name="ContainerName" value="mysqlphp11" />
      <Setting name="FullBackupHour" value="06:00" />
      <Setting name="IncrementalBackupDuration" value="10" />
      <Setting name="RecycleThreadSleepTime" value="300" />
      <Setting name="EnableWindowsAzureDrive" value="False" />
      <Setting name="EnableBackup" value="True"/>
. . .

Here’s where you configure if you want to use more than one instance (for failover and the like) and whether or not you want to actually write out to blob storage and all.

The second thing is a MySql_WorkerRole project. This is a C# project that does a little bit of very important work for us. To sum up, it copies the MySql bits out to Windows Azure, starts the process running and then monitors the health of the MySql server.

All we have to do now is deploy. To do that, run the Runme.cmd. This will package things up, copy them out to the development fabric, starts the various roles and then launches the browser.

Side note on the development experience – I’ll also warn you now that playing with the firewall on your dev box is a little tricky because every time that you redeploy it creates a new package and copies the MySql executables to a new location. That means that you pretty much have to open a incoming port rather than just authorizing the program unless you want to reauthorize the with your firewall every time.


Although I recommend using MySql on Windows Azure for stopgap and last resort, the awesome news is that with the Windows Azure MySQL PHP Solution Accelerator it’s actually not that hard to setup and works pretty well.

Windows Azure Command Line Tools

Josh Holmes - Erubycon 2009 - Day 2There are times that you just need to leverage the raw power that you can get from the command line. For example, if you are trying to script something or if you are on a machine that is not all tooled up with Visual Studio, Eclipse and the like and, believe it or not, there are times that it’s just a lot easier to get stuff done without an IDE in the way. Great news is that we’ve got a couple in the Windows Azure SDK called CSPack and CSRun that work wonders.

To that end, please enjoy this little tutorial on using the command line tools to create a very simple Azure package and deploying it up to the development fabric.

Before you even start you will need one of the Windows Azure SDKs installed. I’m testing this with the November 1.0 release.

First, create a directory where you will place your project. In that directory, create a directory called WebRole. At this point you will have


In the WebRole directory, place the files that you want to be deployed with your Windows Azure package. For mine, I just created a very simple HTML file that looks as follows:

<head><title>Quick Sample</title></head>
This a quick sample. <br />
<img alt="Sample Photo" src="photo.jpg" />

In the root folder for your project, there are two files that you need to create. The first file is is the definition file. I called mine simple.csdef:

<?xml version="1.0" encoding="utf-8"?>
<ServiceDefinition name="Simple" xmlns="">
  <WebRole name="WebRole" enableNativeCodeExecution="true">
      <!-- Must use port 80 for http and port 443 for https when running in the cloud -->
      <InputEndpoint name="HttpIn" protocol="http" port="80" />

The second file is the configuration file. Mine is called simple.cscfg:

<?xml version="1.0"?>
<ServiceConfiguration serviceName="Simple" xmlns="">
  <Role name="WebRole">
    <Instances count="1"/>

Now we are ready to start using the command line tools. The first one is called CSPack. What this tool does is create a deployment package for you.

c:\Project>cspack simple.csdef /copyonly
Windows(R) Azure(TM) Packaging Tool version
for Microsoft(R) .NET Framework 3.5
Copyright (c) Microsoft Corporation. All rights reserved.

If you look in your directory structure now, you’ll see a new folder called simple.csx. Check it out and you’ll see that what it’s done is create a very specific folder structure ready to deploy out to the dev fabric. This is done with the /copyonly option.

The next tool is the CSRun tool. This does the actual deployment out to the dev fabric and can even, if you so choose, launch the browser for you. You need to pass it the name of the ready to deploy directory that the CSPack tool created and the name of the service configuration file.

c:\Project>csrun simple.csx simple.cscfg
Windows(R) Azure(TM) Desktop Execution Tool version
for Microsoft(R) .NET Framework 3.5
Copyright (c) Microsoft Corporation. All rights reserved.

Using session id 1
Created deployment(31)
Started deployment(31)
Deployment input endpoint HttpIn of role WebRole at

Now you are ready to run and test


To find out more about these tools read Windows Azure SDK Tools Reference

Windows Azure Storage Services REST API

Hard DriveIn playing Windows Azure, I’ve started getting into the Windows Azure Storage Services REST API. The REST API gives developers from any languages and/or platforms access to all of the Storage from either inside of Windows Azure or outside. It supports both HTTP and HTTPS. With it you can do just about anything that you need to with Blobs, Queues and Tables.

For example, if you want to create a new table in the Windows Azure Table Storage you can just send it a little bit of XML that looks like this:

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<entry xmlns:d=""
  <title />
    <name />
  <content type="application/xml">

There are a couple of small things that are a little wonky.

First, the URL is RESTish to be honest. Check out the last bit of this sample URL that does a search on a set of entities in a table:$filter=(Rating%20ge%203)%20and%20(Rating%20le%206)

That last part of the filter is something that’s the “ish” part. It’s the query that’s used to search the entities.

The second things that’s a wonky is that there are a handful of things that you can do from the native .NET libraries that you can’t do from the REST interfaces. For example, you can’t do LINQ from the REST interfaces. There are little things like that across all of the storage options but what it really says is that you should use the native libraries where possible.

Third thing that I found a little wonky but it kinda makes sense is that every request against the REST service has to have an authorization code. It is passed in as an HTTP header.

Authorization=”[SharedKey|SharedKeyLite] <AccountName>:<Signature>”

Anyways, I thought it was an interesting set of services and they are really useful especially if you’re doing something other than .NET.

Read more about them at Windows Azure Storage Services REST API

Windows Azure SDK 1.1

There’s an update to the Windows Azure SDK, version 1.1. The SDK extends Visual Studio 2008 and the upcoming Visual Studio 2010 RC making it easy to develop, debug, package and deploy Windows Azure Applications.

There’s a number of new things and a handful of bug fixes from the 1.0.

From the download page:

  • Windows Azure Drive: Enable a Windows Azure application to use existing NTFS APIs to access a durable drive. This allows the Windows Azure application to mount a page blob as a drive letter, such as X:, and enables easy migration of existing NTFS applications to the cloud.
  • OS Version Support: Allows a Windows Azure application to choose the appropriate Guest OS to run on in the cloud.
  • Bug Fixes
    • StorageClient: Expose account key from storage credentials, expose continuation tokens for pagination, and reduce maximum buffer size for parallel uploads.
    • Windows Azure Diagnostics: Fix path corruption for crash dumps, OnDemandTransfer now respects LogLevelFilter.
    • VS 2010: Improved packaging performance.
    • VS 2010: Support for linked files in Web projects.
    • VS 2010: Support for ASP.NET web project web.config transformations.
    • Certificate selection lists certificates from LocalMachine\My instead of CurrentUser\My.
    • Right click on Role under Roles folder to select whether to launch the browser against HTTP, HTTPS or not at all.

Windows Azure Tools for Microsoft Visual Studio includes:

  • C# and VB Project creation support for creating a Windows Azure Cloud Service solution with multiple roles.
  • Tools to add and remove roles from the Cloud Service.
  • Tools to configure each Role.
  • Integrated local development via the Development Fabric and Development Storage services.
  • Running and Debugging a Cloud Service in the Development Fabric.
  • Building and packaging of Cloud Service Packages.
  • Browsing to the Windows Azure Developer Portal.

Download details: Windows Azure Tools for Microsoft Visual Studio 1.1 (February 2010)