Hacking the Windows Azure PHP Command-line Tools to use your ServiceConfiguration.cscfg settings

March 15, 2011

Newer Note: The Interoperability Team at Microsoft has annouced a new version of the Windows Azure SDK for PHP which contains a set of shiny new command line tools and has deprecated the Windows Azure PHP Command-line Tools project. This post is not valid for the SDK, however a config file of the same name will be edited with the new tools. See http://azurephp.interoperabilitybridges.com for documentation on the new SDK tools

 

Note: This is currently valid for the Thu Mar 10, 2011 release. Likely in the future custom ServiceConfiguration.cscfg files will be supported in the project directory.

It takes some time to upload a Windows Azure package and run through the update process, and if you are using the Windows Azure PHP Command-line Tools you probably have run into the same situation I have. You are going along merrily developing on  your local machine and then you are ready to deploy. You run the package.php script to build yourself a Windows Azure package, edit the ServiceConfiguration.cscfg file with your storage connection settings and upload to the cloud. Yay, your app is finally up, now it’s time to relax. But wait! What’s that? A bug you missed? Darn. Back to the coding cycle, but this time after running package.php and uploading your whole application is broken. Yikes! What happened? Oh yeah….that pesky little ServiceConfiguration.cscfg file was recreated by package.php and you forgot to edit it before uploading. Nothing to do now but edit the file and upload the whole kit-n-caboodle again.

I fairly regularly forget to edit the ServiceConfiguration.cscfg file and it drives me nuts. Turns out there is a simple way of ensuring you always get your connection settings and there is no need to worry about remembering to edit the file.

Cruise on over to the directory containing your command-line tools and take a look inside the “res\tool” folder and what sight should await your wondering eyes but the ServiceConfiguration.cscfg file! Edit it to your heart’s content and those changes will always be in your new builds.

Learn more about running PHP on Windows Azure at http://azurephp.interopbridges.com

2 thoughts on “Hacking the Windows Azure PHP Command-line Tools to use your ServiceConfiguration.cscfg settings

  1. blobaugh (April 4, 2011)
  2. Ben Lobaugh Online » How to change VM size with the Windows Azure PHP Command-line Tools