Sunday, October 14, 2012

My great Azure adventure

What started out as a quick setup in Windows Azure ended in deployment frustration. My intent was to take my existing ASP.NET MVC 4 application off my current shared hosting plan and subversion for source control and  move it to Azure and TFS. After hearing all the hype, I figured it was at least worth looking into.

Setting up the account
Thanks to Microsoft BizSpark, I was able to take advantage of a free Azure account for a year. This was very easy (though I wasn't thrilled with the fact that I had to enter a credit card number for a free account), and within a few minutes I was looking at my dashboard.

Moving off of subversion to TFS
This was *much* easier than I thought it was going to be. Turns out, all that's needed here is to right-click on the project root folder, and select 'Export' from the context menu. Select the same folder, and it prompts you  with a warning that it will remove all the svn folders, thus removing the binding to subversion.

Moving the database to Azure
Again, super easy. Turns out, in SQL Server 2012, there's an option for 'Deploy database to SQL Azure'. After providing the connection string info, it was a few clicks through a wizard and done.

Publishing the MVC site to Azure
This is where things started to get messy. I deployed the site to Azure, and during the deployment, I was met with a 'Failed to open url . Exception: Class not registered' error, but then the deployment continued with the final output message being 'Success'. So I thought 'whatever, maybe that was nothing terribly important'. I went to navigate to my site and was met  with a Security Exception. Um, huh? I was expecting perhaps a database error in the event that perhaps a permission didn't get carried over, but this wasn't even getting that far. So, I looked into the stack trace. Ah, right. My custom Membership Provider was writing to the event log on error. Probably frowned upon in this environment. Fine. A quick tweak to the code and I was able to see the actual database error - a missing stored procedure. A quick update to the database and the site was up and running. 

So that's not so bad. That's where it sits now. The remaining task is to switch my DNS to point to the new Azure site. This part might be a deal breaker for now anyway. In order to get my 'naked' url sans the 'www' to work (Scott Hanselman's term, not mine: I'm going to have to pay a bit. Not that I'm cheap, but, well, I'm cheap. And I'm supposed to be getting this service through the Microsoft BizSpark program. This is an excellent program, by the way. But my complaint is this. Why would I want to launch a web site and not be able to access the site without the user entering 'www' in the url?

At this point, the jury is still out. what will make my decision for me is the extent to which I'm reminded that I'm developing the app to be deployed to Azure. I just want to build my MVC app using the tools with which I'm familiar. Managing Azure is not something I want to be constantly doing. I'll do a follow up in a week or two with more observations. Or, you can follow me on Twitter (@vinbrown2) to check my latest rant.


  1. Doesn't Bizpark include 150/month of free Azure hosting? I love Azure, but for a hobbyist it does get expensive fast.

  2. @Patrick Yes it does. In fact, that's what I'm using now. Bizspark is a great program. If you're just using it as a hobbyist, as far as I know you can use Azure for free and get quite a bit of functionality. Do correct me if I'm wrong about that though.