Pages

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 http://code.msdn.microsoft.com/wazdmon.
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 http://pdc10sessions.cloudapp.net/.
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 http://odata.microsoftpdc.com/ODataSchedule.svc 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("http://odata.microsoftpdc.com/ODataSchedule.svc"));

    // 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>

<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 %>
            </h1>
            <p class="location">
                <%: startTime %><%: !string.IsNullOrEmpty(session.Room)
                                    ? string.Format(" ({0})", session.Room)
                                    : string.Empty %>
            </p>
            <p class="description"><%: session.FullDescription %></p>
          </div>
    <% } %>
</asp:Content>
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: http://cdn.blog.smarx.com/files/DoodleJoy_source.zip. 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 http://odata.codeplex.com/. (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.