I was very excited when I found out Microsoft was doing a free Azure trial. One of the big deterrents for me to use Amazon ETC or Windows Azure is the cost. Despite being gainfully employed, I have the (bad?) habit of funding my ‘hobby’ development like I’m still a sixteen-year-old flipping burgers. Sixty dollar bar tab, no problem. Sixty dollar Azure bill for the month – that’s outrageous! To be fair, I do have a Dreamhost VPS that only costs me about twenty dollars a month (300 MB of ram on Linux).
NLog is an easy to use logging package that can be plugged into virtually any .net application. In my recent experimentation with the Azure platform, I ran into a few hurdles with NLog integration. Azure is intended to allow for horizontal scaling, so you can’t design for a single ‘box’ running your application. While the benefits are many, the drawback to the architecture is that you can just write a file out to a logs directory on your server. But fear not, friends; there is a fairly easy way to get NLog working with Azure using a few simple config settings.
After my weekend blitz to get an Azure project in the cloud last week, I’ve learned a few things about the platform that I missed in my previous haste.
SQL Server Management Studio (SSMS) doesn’t do GUI for Azure
I misspoke in my previous article. You can connect without issue to an Azure database but, according to this stack overflow post, you’re basically limited to scripting out your create table statements. For SQL gurus this might not be a problem, or even preferred. However, for us mortals who still have to look up the syntax to create a cascading delete constraint (included below), it’s not optimal.
ALTER TABLE [dbo].[Childtable] WITH CHECK ADD CONSTRAINT [FK_Childtable_ParentTable] FOREIGN KEY([ParentId]) REFERENCES [dbo].[ParentTable] ([Id]) ON UPDATE CASCADE ON DELETE CASCADE
SQL Server Data Tools (SSDT) are solid
I always hated the built-in data connection functionality of past Microsoft products (VB6 comes to mind…yes, I’m that old). Visual Studio data tools gives you everything you need to build a database properly including scripting out commands and data created using the GUI. I was able to easily setup a database with a full set of constraints without any pain.
There are three main ways to run your application on Azure
- Cloud Services
- Virtual Machines
This guide by Microsoft goes in depth and explains it better than I can. I’ve been using websites which are extremely easy to deploy to and should automatically scale up based on load. If I need more control, switching to one of the other methods is not a gargantuan task. Since websites are stateless on Azure, I will be experimenting with writing error logs since you don’t have persistent file storage. Stay tuned…
I’m sad to admit that I’ve yet to create an Azure project despite the massive hype train promoting it the last few years. While researching cost effectiveness vs. Amazon E2C, I saw that Microsoft was offering a free trial. Few words motivate me like the word ‘free’ so I set out to get a site up and running. I had a small project I wanted to do and figured this was a perfect test case.