Windows Azure – I can’t say no to a free trial

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.

Here is a quick guide on how to pronounce ‘Azure’. I’ve been saying it wrong for the past two years; luckily, so has almost everyone else.

A few thoughts I had before I started this adventure:

  • Azure is expensive compared to traditional hosting
  • Azure does not use the traditional Microsoft SQL Server we all know (and sometimes love)
  • Azure virtual machines are limited compared to a vanilla Windows server instances
  • There is Azure specific coding required

Signup for an account

Go here and follow the instructions. You’ll need a Microsoft account. You’ll also need a phone number to confirm your Azure account.

Setup a VM

VirutalMachine01Edit: If you are using Azure Websites, you don’t need to create a Virtual Machine. Once you create an account, I simply went in and created a virtual machine. The free trial limits you to a very small (768 MB of memory) shared core instance.The dashboard is sharp and gives you a lot of information on your usage. 

VirtualMachine02After I created my virtual machine, I added my local IP to the firewall settings and connected via remote desktop. I then configured the roles I figured I would need to get a web app up and going. I admit I did neglect to read any documentation. I was banking on the setup being similar to Windows Server. For the most part it was until I tried to install a SQL server role. You don’t just bring up a server on the same ‘box’ (I think you can actually create an Microsoft SQL server VM if you’re so inclined – I wasn’t).Roles01

Create a Database

SQL databases can be configured in the web dashboard. I first did a quick create which put my database in Southeast Asia. I had a hunch that having my web app in the Eastern United States and my database in another hemisphere could cause performance issues. I deleted it and used ‘custom create’ to place it in the Eastern United States. Now the application and database server are best friends hanging out in the Eastern data center.

Silverlight Admin

The Web client gave me connection issues

Azure told me to install the Visual Studio tools to edit my database. I easily connected to the database inside of Visual Studio. Microsoft also offers a web interface to design your database. I did notice the interface was created in Silverlight, likely before they changed their strategy to HTML5. I tried it out, as I normally just use PHPMyAdmin for creating my MySQL databases when working with the LAMP stack. Creating tables was fairly straightforward, keeping in mind I didn’t have the need for any fancy T-SQL programming. It’s very minimal, compared to something like PHPMyAdmin but it is functional. I ended up getting a ‘too many connections’ error a few times and just fell back to using the normal data tools and abandoning the web based tool.

Visual Studio DB Admin

Creating DBs in Visual Studio

Deploying to the Cloud


Web Publishing is Easy

Edit: This is for Azure websites, VMs would deploy as they would any Windows Server. Lets skip the step where I actually develop a full-on MVC web app and get into deploying to Azure. My typical practice for deploying MVC/WCF to IIS is to do a file system deployment to my local machine and then just copy the files over.

I started this site before I even thought about using Azure. Am I going to have to rewrite my MVC site to use Azure’s capabilities? If so, I might just stroll on over to Amazon. Turns out Azure runs .net 4.5 MVC projects without issue.

The publish process was fairly painless, with one exception. You sign in to your Azure account and generate a certificate. Import the certificate into Visual Studio and you’re almost there. I’m not going to detail all the steps, as they are outlined here.

I recommend you setup Database Deployments

I recommend you setup Database Deployments

The one thing I ran into is that Azure creates a new database for your published site. I didn’t necessarily want to mess around with that at the moment so I tried to ignore it and assumed it would use the connection string in my web.config. However, try as I might, it would always go to this new blank database Azure created. I couldn’t find where this connection string was coming from, even after searching my entire solution for the collection name it was assigning on the server. Eventually, I gave up and just set up a database deployment in the Visual Studio settings and my deployment worked like a charm. About ten minutes after I deployed the site, I figured out you can set you connection string under ‘Web Sites’->’Configure’ in the Azure portal.


Here is the site:

It’s not pretty and I’ll be working on some CSS/functionality, but it does demonstrate an MVC site running to an Azure SQL database.

So what does it do?

  1. A service program monitors a directory on a client waiting for an export of some racing data
  2. When the monitor program detects a new export file, it submits it to a WebAPI service using RestSharp (get it on Nuget!).
  3. The data processes and inserts into an SQL Database using the Dapper library (also on Nuget!)
  4. End users can view the racing data through a website created using MVC


To address my three points before I started this experiment:

  • Azure is expensive compared to traditional hosting – I haven’t paid yet, I’ll let you know next month. I expect it will be much more than my dream host account. 
  • Azure does not use the traditional Microsoft SQL Server we all know (and usually love) – It doesn’t, but it worked exactly the same for my limited trial.
  • Azure virtual machines are limited compared to a vanilla Windows server instance – Yes, it is very minimal compared to Windows Server. You are not just buying a Windows Server VM; if you need that, use Amazon. Update: It’s actually running Windows Server 2012 Data center. So in theory you can do anything you could on a normal Windows Server. 
  • There is Azure specific code necessary – I deployed an MVC application with no special coding. 

Besides the DB hiccup I ran into, the whole process was pretty seamless. I set up a basic virtual machine, website, and database without too much trouble. Publishing is basically a few clicks to publish my site and a copy of the db.

Will I continue hosting sites on Azure? We’ll have to see how hard my wallet gets hit next month.

Leave a Reply

Your email address will not be published. Required fields are marked *