Simplify Azure Deployment

It blows my mind how freaking difficult and slow Azure deployments are…  I have used AppHarbor and Google AppEngine in other projects and I can deploy a new version in about 20 seconds flat.  Azure is painful.  For starters, my deployment package is 50 megs.  50 FREAKING MEGS!!!  Are you kidding me???  It’s an MVC app with less than 10 pages, how did that turn into 50 megs…  To add to the pain, I couldn’t figure out an easy way to switch database connection strings from dev to production during deployment.  I haven’t timed the entire thing but I think it takes like 10 minutes – that’s just tooooooo SLOOWWWW!!!!

 

In order to stay sane and simplify the process a little, I put together a nant build script to:

  1. Switch connection strings to production values
  2. Build the project i.e. create the package
  3. Deploy it to azure
  4. Switch connection strings back to dev values

Here is the Nant script

 

As you can see the deploy to azure step calls a powershsell script, here is the content of that file:

 

The above script will upload the package to azure.  Notice that add snapin command in the beginning of the file, you will need to install the Windows Azure PowerShell Cmdlets to get that working.

 

Credits

Thanks to these helpful blog posts, I was able to figure it all out:

http://msdn.microsoft.com/en-us/gg271300

http://stackoverflow.com/questions/5346919/windows-azure-powershell-deployment-error-the-remote-server-returned-an-unexp