With all the hype about Windows Azure and having Visual Studio 10 at my disposal, I decided to exercise a little of my inquisitive nature and work through a demo project using a little of my spare time. I was curious to see how it all fitted together and what new project options might be available in Visual Studio. If you’re thinking of taking your very first step in the Azure world, this post could be for you, but you will be required to have knowledge of Visual Studio since I do not explain many of the basic steps in creating projects etc. within a Visual Studio solution.
To get started with Azure, the first thing I did was sign up for an account and whilst this required a credit card, there were no initial charges and I was able to create and deploy an application for free for a limited period of time. The free trial package contained 750 small compute hours per month, a 1GB web edition SQL Azure relational database, 20GB of storage with 1,000,000 storage transactions, a 20GB limit on Outbound bandwith and unlimited Inbound traffic. This seemed like a reasonable offer for getting started and having at least some time to examine some of features. I did notice that after one month Microsoft asked me to upgrade the account if I wished to continue using my demo application and they provided a number of pre-paid or pay as you go options, although the free period is actually for 90 days. Since my application was demo only, I declined, however I would seriously consider it, if I had a purposeful application to deploy.
Azure Management Portal
Before I started following an example Azure project in Visual Studio, I had to install the Windows Azure SDK for .NET kit which included tools for Visual Studio and some client libraries for .NET. There were no problems with the executable download and subsequent installation. It’s worth noting that an installation of SQL Server (or Express) is also useful for working with your databases although not (to my knowledge) strictly necessary, since Azure provides the capability to create, manage and delete databases in the cloud with the Azure Management Portal and interact with the databases via the SQL Azure Management Portal.
Azure Project in Visual Studio Solution Explorer
The next section of the exercise involved creating a SQL Azure database, i.e. a cloud-hosted database using the Azure Management Portal. This was very simple to do, the portal itself was easy to navigate around and provided options for creating hosted services, storage accounts, database servers and networks. I found that configuring the required options by following the demo project instructions was a sinch and it was satisfying to see that it actually worked. Now that the database was created I logged into the SQL Azure Management Portal which is specifically used to work with the databases created using the Azure Management Portal. By a combination of the SQL Azure Management Portal and my local installation of SQL Server 2008 Express I was able to create and deploy my first cloud-based database, which contained a simple list of fake employee details, in minutes.
From the Visual Studio side, I selected the Windows Azure Project from the Cloud template and then selected the ASP.NET Web Role, adding that to the solution. This generated a default ASP.NET project and a default Azure project in the solution. After that it was a simple matter of connecting the database already in the cloud and adding a GridView Control to the ASP.NET page. My SQL Azure database (in the cloud) was then defined as the data source object for the GridView control. Again following the demo I entered a simple SQL statement to select the first and last names from the database when configuring the Data Source object and tested this to ensure it returned the correct values. Anyone familiar with Visual Studio and the GridView control will know that this is ‘meat and potatoes’ stuff.
The GridView and Attached SQL Azure Database Object
The penultimate section in the Azure example I followed then gave an overview of how to connect to the SQL Azure database via a number of different methods; ADO.NET, ODBC, OLEDB, and LINQ as well as other technologies such as Java and PHP. The point of this exercise was to illustrate that connecting to a SQL Azure database is largely the same as connecting to a standard SQL Server database, with the exception that the type of connection and connection strings are different. Microsoft did seem to be pushing the idea with this section of the exercise that it is a fairly trivial matter to connect to a SQL Azure database and it is open to a variety of well-know technologies.
When it comes to publishing an Azure application to the cloud using Visual Studio, there are a number of different options, but one of the easiest has to be the ‘Publish’ option which is available by right-clicking on the Azure project selecting Publish. This does take several minutes, but when it completes a link is available to the website and it is effectively available for use provided the user has selected that it is a ‘Production’ website (there is an option for ‘Staging’ as well).
So there we have it, a short, sweet and very high level overview of my first experience with Azure and I have to say, it was quite pleasant.