Tuesday, December 7, 2010

November 2010 Release of the Windows Azure Tools + SDK

Today, coinciding with the general availability of the new Windows Azure Management PortalMicrosoft has released version 1.3 of the Windows Azure Tools and SDK.
The Windows Azure Tools for Microsoft Visual Studio extends Visual Studio 2010 to enable the creation, configuration, building, debugging, running, packaging and deployment of scalable web applications and services on Windows Azure.
 New in this release:
  • IIS Support: Full IIS is supported for building and deploying web roles, both in the development environment and in Windows Azure.
  •  Remote Desktop: Support to enable and configure Remote Desktop connections for all your roles in the Windows Azure project;
  • Virtual Machine (VM) Role: Allow you to add a VM role to your Windows Azure project, select the VHD for your VM role, configure and deploy the VM role;
  • Virtual Network:  Support to activate Windows Azure Connect for your roles, to provide connection between Azure and on-premise resources;
  • Diagnostics: Updated support for diagnostics to use the new plug-In;
  • EndPoints Support Enhancements: Refreshed support for Endpoints according to platform update.

Windows Azure Diagnostics Viewer

I’ve just finished publishing a prototype of the Windows Azure Diagnostics Viewer onto code gallery at
The Windows Azure Diagnostics Viewer is a prototype web application that can be used to view and analyze Windows Azure Diagnostics information.
Windows Azure Diagnostics Monitor Screenshot
The Windows Azure Diagnostics Viewer has 2 components, a website and a scheduler. The website provides a UI to allow you to view diagnostics information collected by Windows Azure, including performance counter graphs, logs as well as some customer data including Windows Azure Queue statistics and service status data.
The website is designed to be “injected” into an existing worker role by adding references to a few dll’s as well as the website “exe”. The goal here is to make adding the viewer to a project painless – although in the prototype there are still several steps to complete.
Once started, the viewer website uses the HWC to host the website.
As well as simply viewing data collected by the existing Windows Azure Diagnostics system, the viewer can also display pre-aggregated data as well as information about Queue lengths and even service status. It does this with the help of the scheduler.
The scheduler is also designed to be “injected” into a role, and simply executes specified tasks. These tasks are contained in dll’s which are loaded from blob storage. The viewer provides shortcuts to common tasks, such as queue length collection and data aggregation.
Whilst this is a prototype, it has inspired some other thinking and ideas. You can expect a rev for the new SDK shortly after the new SDK hits as we’d like to take advantage of some of the new SDK features.
Anyway, check it out and let us know what you think.

Building a Mobile-Browser-Friendly List of PDC 2010 Sessions with Windows Azure and OData

I learned today that there’s an OData feed of all the PDC 2010 sessions. I couldn’t help but build a Windows Azure application that consumes that feed and provides a simple web page that works well on mobile browsers. You can use it at
I’m enjoying the ease of use of OData in .NET. OData is the protocol that Windows Azure tables uses, and I’m also starting to use that to expose data in other applications I write. To share the joy, I thought I’d share how I built this app.
All I did was add a service reference to and write a simple controller method.  Here’s the controller method:
// cache for thirty seconds
[OutputCache(Duration=30000, VaryByParam="*")]
public ActionResult Index()
    var svc = new ScheduleModel(new Uri(""));

    // prefetch presenters to join locally
    var presenters = svc.Speakers.ToDictionary(p => p.Id);

    // prefetch timeslots to join locally
    var timeslots = svc.TimeSlots.ToDictionary(t => t.Id);

    var sessions =
        from session in svc.Sessions.Expand("Presenters").ToList()
        where session.TimeSlotId != Guid.Empty // skip the recorded sessions
        let timeslot = timeslots[session.TimeSlotId]
        let presenter = session.Presenters.Count > 0 ? presenters[session.Presenters[0].Id] : null
        orderby timeslot.Start
        // tuple because I'm too lazy to make a class :)
        select Tuple.Create(session, presenter, timeslot.Start == DateTime.MaxValue
            ? "recorded session" : timeslot.Start.ToString());

    return View(sessions);
And here’s the ASP.NET MVC page:
<%@ Import Namespace="PDCSchedule_WebRole.ScheduleService" %>
<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master"
    Inherits="System.Web.Mvc.ViewPage<IEnumerable<System.Tuple<Session, Speaker, string>>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    PDC 2010 Session Schedule

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <% foreach (var tuple in Model) {
          var session = tuple.Item1;
          var speaker = tuple.Item2;
          var startTime = tuple.Item3; %>
          <div class="session">
            <h1 class="title">
                <%: session.FullTitle %>
                <%: speaker != null
                    ? string.Format(" ({0})", speaker.FullName)
                    : string.Empty %>
            <p class="location">
                <%: startTime %><%: !string.IsNullOrEmpty(session.Room)
                                    ? string.Format(" ({0})", session.Room)
                                    : string.Empty %>
            <p class="description"><%: session.FullDescription %></p>
    <% } %>
The only other important thing I did was add a meta tag to get mobile browsers to use the right viewport size:
<meta name="viewport" content="width:320" />
I’ll be using this at PDC this Thursday and Friday to find the sessions I’m interested in. If you’ll be attending PDC in person, I hope you find this useful too.

Applications with the Windows Azure Platform

I presented a session called “Building Windows Phone 7 Applications with the Windows Azure Platform.” Thanks to all who attended in person and virtually! As promised, I’m going to share all the source code from my session here on my blog. To start with, I’ve just published the source code for my “DoodleJoy” application here: The source includes both a Windows Azure application that hosts an OData service and a Windows Phone 7 application that consumes it.
To get the application running, you’ll need the just-released OData client for Windows Phone 7, which you can find at (Click “View all downloads” to find the binaries and code gen tool.) Then open the two projects (phone and cloud) in separate Visual Studio instances. Run the cloud project first, and note the port. If it’s running at anything other than port 81, you’ll need to edit the URL in MainViewModel.cs in the phone project to point to the right location. Then launch the phone project, and things should just work.

Sunday, October 24, 2010

Azure Pricing vs Amazon AWS Pricing Comparison

How does Azure stack up against its main rival, Amazon, in pricing?

Compute Instances

The standard compute instances sizes are very similar on both platforms – Small (1 core processor, 1.7GB RAM) , Large (4 core processors, 7GB RAM), Extra Large (8 core processors, 15GB RAM ). The only differences being that Azure offers slightly larger drive space on the Large and Extra Large instances, on the Large instance Azure provides 1TB of space vs 0.85TB on AWS , and on the Extra Large instance Azure offers 2TB vs 1.8TB on AWS. However this is probably a minor issue to most cloud platform users who will be more interested in the persistent storage offered (see below).
Azure includes a Medium instance which provides 2 core processors, 3.5GB RAM, 500GB hard disk and is a useful bridge between the Small and Large instances for growing applications.
In addition, Amazon offers a variety of larger instances. High Memory instances provide 17GB – 64GB of memory and High CPU Instances provide up to 20 ‘compute units’ (which equates to 20 cores of processing power).
Pricing for compute instances is identical on AWS and Azure.
Compute instance pricing on AWS and Azure:Small : $0.12 per hour
Medium : $0.24 per hour  (Azure only)
Large : $0.48 per hour
Extra Large :  $0.96 per hour
(NB : All AWS pricing is based on Windows instances, Linux based instances are typically 30% cheaper)
Amazon is currently running a pilot program to transfer Windows Server licenses to EC2. Under this program, pricing for the EC2 instances drops 30% to the Linux EC2 levels. See full details of the Windows Server Mobility program.
The basic pricing models for both AWS and Azure are very similar, however in addition to the standard pricing model Amazon offers Reserved Instances. A reserved instance involves payment of a one time up-front fee that ‘reserves’ an instance which is then available at a lower hourly cost. Instances can be reserved for one or three year terms and pricing varies according to instance size and length of the reservation.
For an assessment of the pricing impact I have amortized the upfront payment equally over the term of the reservation (assuming 12 months usage at 730 hours per month). For example, the one time fee to reserve a Small Instance is $227.5 and thereafter usage on the instance is charged at $0.05 , thus assuming full utilization of the instance the $227.5 payment is $0.026 over the year (227.5 / 12/ 730) and the total hourly cost of the instance is $0.076 (a saving of 37% over the normal charge of $0.12 per hour). If the instance was reserved for three years the charge would be $350 and the final cost would be $0.0.61 per hour.
Amazon AWS Reserved Instance Pricing (Assuming Full Utilization) :Small : $0.076 (1y term) , $0.061 (3yr term)
Large : $0.304 (1y term) , $0.253 (3yr term)
Extra Large :  $0.608(1y term) , $0.507 (3yr term)
All charges are per hour
Amazon also offers spot pricing, which is hourly updated pricing for instances that cannot be booked for any period longer than an hour which  is essentially live market pricing for instances. This is likely only to have very niche appeal for apps which can be run at any time – large batch processing tasks could conceivably use this pricing service.


Cloud apps need to use persistent storage for files (such as images, videos etc) which are then referenced in the app. Both Amazon’s S3 (Simple Storage S0lution) and Azure Storage price storage at $0.15 per GB, however S3 offers discounts for very large data amounts stored (for example, $0.140 per GB for 50TB – 400TB of storage).
Transactions on both Aaure and AWS are billed at $0.01 per 10,000 transactions, it should be noted there is a slight difference in this as S3 only charges for requests for stored items whereas Azure charges for inward storage transactions as well.
For the Azure CDN versus Amazon’s CloudFront, see our separate article on Azure CDN Pricing .

Data Transfers

Under traditional hosting this would be called bandwidth but the convention for cloud providers is to use the term Data Transfers.
F0r both Azure and AWS, Data Transfer is charged at $0.10 per GB of inbound traffic and $0.15GB per GB for outbound traffic. Azure pricing is constant for all volumes whereas AWS provides discounts for large volumes of outbound traffic – $0.11 per GB for > 40TB ,  $0.09 per GB for >100TB , $0.18 per GB for >150TB.
Prior to June 30, 2010 AWS offers free inbound data transfer and Azure offers free inbound off-peak data transfer.


Database offerings for Azure and AWS are structured very differently and for that reason are not directly comparable. Amazon’s AWS does not offer  per  database plans and fro SQL Server  you can only use a SQL Serve license to install a full instance of SQL Server on an EC2 instance , or you can use the free SQL Server Express. Azure, by contrast, only offers individual databases of the SQL Server based SQL Azure.
Amazon offers relational database (MySQL) instances which are comparable to EC2 instances with a full MySQL instance installed (and can therefore have numerous databases).
SQL Azure databases are priced at $0.014 per hour for a  database with 1GB of storage and $0.14 per hour for a 10GB database. A 50GB database for SQL Azure has been announced and will be available from June 2010.
By contrast, Amazon’s Small Relational Database Instance has 1.7GB RAM and a single core processing unit which is charged at $0.11 per hour. Storage is charged at $0.1 per GB per month and an instance can have between 5GB and 1TB of storage.
AWS database instances can scale all the way up to the Quadruple Extra Large DB Instance which has 64GB RAM ,  with 26 compute units and 1TB storage.
Both Amazon and Azure offer non-relational databases which are considered persistent storage and charged accordingly (see above).

Packaged Pricing

The obvious question any user will have is what will be the total cost to run the app on the cloud. To this end Microsoft has two offerings which provide a package of resources available at a single monthly charge (overages are charged at the standard rates). By contrast Amazon only offers al-la-carte pricing.
The Azure Development Accelerator Core is charged at $59.95 per month for a six month subscription and provides:
  • 1 month of utilization for a Small compute instance
  • 10GB of persistent storage plus  1,000,000 storage transactions
  • Data Transfer – 14GB outward, 7GB inward
A comparable setup on Amazon would be $95 if the EC2  instance is not reserved, $61.5 if the instance is reserved for one year and $52 if the instance is reserved for three years.
The Azure Development Accelerator Extended is charged at $109.95 per month and is identical to  the Accelerator Core package with a 10GB SQL Azure database included, and this package therefore doesn’t lend itself to a comparison with Amazon AWS.


Across all the services the pricing for Azure and Amazon AWS is very similar, however there are three key differences :
  • Databases - Azure only offers a per database pricing, whereas Amazon offers full database instances. As Azure offers the SQL Server based SQL Azure database this is a more full featured and more expensive alternative to Amazon’s MySQL based offering.
  • Reserved Instances – Amazon allows for an upfront payment to reserve an instance for one or three years which results in a substantial (37% – 50%) saving if the instance is used for the full period.
  • Packages - Azure offers a package of services at a single monthly charge which results in a 50% saving of the regular prices.
NB In this review I have ignored services which have no natural equivalent such as the Azure AppFabric services, or the Azure Asian bandwidth charges for Azure instances location in Asia (AWS instances do not have a geolocation feature).

How to Migrate SQL Server Database To SQL Azure

SQL Azure is essentially a cut down version of SQL Server and so we would expect that migrating from SQL Server to SQL Azure should be a straightforward task. However, in the first release of SQL Azure, the scripts generated by SQL Server Management Studio will require some extra cleanup since not all the SQL Server 2008 features are supported in SQL Azure.
For this demo we will use SQL Server Management Studio (SSMS) to generate the SQL scripts and
migrate an existing database from SQL Server 2008 to  SQL Azure. It should be noted that there are several tools such as the SQL Migration Wizard for assisting in the migration, but in this article we will look at performing a manual migration.
Since SQL Azure is built from SQL Server 2008, the database should first be migrated to SQL Serer 2008 if necessary (note – it is not necessary to update to 2008 R2).
  1. Open SQL Server Management Studio (SSMS), right-click on the database node of the database to be migrated (AdventureWorks for this demo) and select Tasks > Generate Scripts , then select the database to be migrated and click Next:
    ScreenHunter 01 Mar. 05 11.11 Migrating A SQL Server Database To SQL Azure
  2. In the Choose Script Options page, we need to configure the script to comply with the restrictions of SQL Azure, so make the following changes:
    • Convert UDDTs to Base Type: Set this  to true as SQL Azure does not support user-defined types. UDDT’s need to be converted into SQL Azure portable types.
    • Script extended properties: Set to false as SQL Azure does not support extended properties.
    • Script USE DATABASE: Set to false as SQL Azure does not support the USE statement.
    • Script Data: Set to false since we are not migrating the data right now.
  3. In the Choose Object Types page – select all the objects except User Defined Data Types and click Next:
    ScreenHunter 03 Mar. 05 11.27 Migrating A SQL Server Database To SQL Azure
  4. In a succession of screens you will be prompted to select the Stored Procedures, Views, Tables etc to be migrated (depending on which objects are in your database). ClickSelect All then Next for each.
  5. Finally at the Output Option page select where the script should be generated (in this example I have elected to have the script generated in a new query window):
    ScreenHunter 04 Mar. 05 11.39 Migrating A SQL Server Database To SQL Azure
  6. Click Next and SSMS will direct you to the Summary page before generating the scripts in a new SQL script window. The Generate Script Success screen shows the progress and results of the migration on the database objects (see below). Copy the script generated to the clipboard.
    ScreenHunter 05 Mar. 05 11.43 Migrating A SQL Server Database To SQL Azure
  7. Log in to the Azure platform portal at and create a target database on the online portal (simply click Create Database after navigating to the the SQL Azure tab and then select the database size).
  8. Close and re-open SSMS to connect to SQL Azure and view your database (seeConnect to SQL Azure from SSMS for details if neceesary) . Note – SSMS in SQL Server 2008 R2 can view the SQL Azure objects and should be used whenever connecting to SQL Azure.
  9. Copy the script into a new script window in SSMS. Before we run the script against the target SQL Azure database we still need to make some modifications to the script:
    • SQL Azure’s first release does not support partitions. Therefore the KEY constraint statement for the table-creation scripts has to be removed and replaced by a separate script. For example, in the original script SSMS generated for creating a data table there are KEYconstraints such as
      [TerritoryID] ASC
      ) ON [PRIMARY]
      This needs to be replaced with a separate ALTER TABLE Script to Assign a Key to a Table, such as:
      ALTER TABLE [Table_Name]
    • If there are any CREATE NONCLUSTERED INDEX statements in the script, these will need to be modified. For example remove the bold type text from the below script section:
      CREATE NONCLUSTERED INDEX [IX_UserTable_FirstName] ON [dbo].[UserTable]
      [FirstName] ASC
That’s it, now run the script against the SQL Azure database (ie click New Query in SSMS, select the target SQL Azure database from the dropdown database listing  and clickExecute).
It should be noted that this is as of SQL Azure Update 1 (February 2010) , SQL Azure is currently developing rapidly and not all the inconsistencies with SQL Server are well documented.