Plenty of New Features for Windows Azure Developers
The last two weeks have been huge for the Windows Azure platform. The Meet Windows Azure event in San Francisco on June 7th kicked off a week of announcements, which continued into TechEd last week. Getting most of the press, and rightfully so, was the announcements pertaining to the functionality now available in Windows Azure Web Sites and Virtual Machines (IaaS). These are without a doubt “game changing” in the cloud computing and Windows Azure space. There were also announcements related to Cloud Services (formerly known as ‘Hosted Services’ – the traditional PaaS offering), SQL Database (formerly SQL Azure), and Windows Azure Active Directory (which now includes Access Control Services).
Today I’d like to share a few areas of that are new for the Windows Azure developer. With the new Windows Azure SDK 1.7 and tooling now available in Visual Studio 2012 RC, there’s a wealth of new tools and techniques available. Let’s take a look at few of the new features now available.
Custom Health Probes (Pages)
The Windows Azure load balancer has always had the ability to check on the status of a role and remove it from rotation if the role is unhealthy. This was done by sending ping requests to the Guest Agent on the role instance. This was great, but it couldn’t tell if the service itself was able to handle requests. If there was a flaw with the service, such as not being able to connect to the database or a 3rd party web service, the load balancer would still send requests to the instance even though it may not be able to properly handle them.
With the new custom health probes, a custom page can be created that could do whatever checking is necessary and return an HTTP 200 if the service can handle requests. The Windows Azure load balancer uses the custom page in addition to the normal checking it does via the Guest Agent. Setting up a custom health page is easy.
1. Create the page – for example, HealthCheck.aspx. It should do whatever is needed to check that service is healthy (connect to the database, call another web service, etc.)
2. Add the configuration to the ServiceDefinition.csdef
a. Add a new LoadBalancerProbes element
b. Add the ‘loadBalancerProbe’ attribute to the InputEnpoint.
For more information on this feature, please visit http://msdn.microsoft.com/en-us/library/windowsazure/jj151530.aspx.
Service Bus Explorer (in Visual Studio)
Visual Studio’s support for direct management of Windows Azure roles and storage has traditionally been somewhat weak. It looks like Microsoft is investing a little more in this area now, especially for Windows Azure Service Bus. There is a new option in the Server Explorer for managing Service Bus. From there you can view the properties of a Service Bus queue, as well as send and receive test messages.
New Role Templates
When creating a new Windows Azure cloud service, there are now two new role templates to choose from: Cache Worker Role and Worker Role with Service Bus Queue. These new role templates set up a little boiler plate code to make working with the new cache features or Service Bus queues just a little easier.
Prior to SDK 1.7 the development emulators for Windows Azure relied on IIS and SQL Server Express or SQL Server. Starting with the June 2012 updates, the compute emulator now uses IIS Express and the storage emulator uses SQL Service Express 2012 LocalDB. This should make the emulators a little faster to start up and hopefully more reliable. If an application requires the full feature set of IIS, you can revert back to the full IIS web server.
Side-by-Side SDK Support
Windows Azure now supports multiple SDK installations on the same machine – starting with SDK 1.6 and SDK 1.7. This means no longer is it necessary to uninstall the previous SDK version whenever a new version comes out. In order to choose the version to use, select it from the dropdown box at the top of the New Windows Azure Cloud Service dialog window when creating a new project.
When creating a Windows Azure project in Visual Studio 2012 RC, NuGet packages are used for the Windows Azure dependencies. This means that instead of using whatever version is installed on your machine (via the SDK), Visual Studio will pull the latest version from NuGet. You can see this by looking at the packages.config file in your project. This is done for packages such as WindowsAzure.Storage (the storage client library), WindowsAzure.ServiceBus, and the new Microsoft.WindowsAzure.ConfigurationManager. This allows you to keep current (if you want) much easier.
Additionally, NuGet packages can be used to help speed the deployment and improve maintainability of our Windows Azure Web Sites. Using NuGet Package Restore we can let Visual Studio (or MSBuild) pull down the files we need, removing the need to add the files to our source control system. With Windows Azure Web Sites, the NuGet packages are cached on Microsoft’s servers allowing for faster downloads.
More details on NuGet Package Restore and WAWS at:
New CloudConfigurationManager class
There is a new class in SDK 1.7 that I think will be very welcome by Windows Azure developers. When writing code that needs to run, for whatever reason, both in the cloud (Windows Azure or the emulator) and locally, and that code needs to retrieve a configuration setting, it was often a minor pain to do so. Developers would often resort to writing a utility method that would check if the code was running in the emulator or not, and then retrieve the configuration setting from either the RoleEnvironment class or the ConfigurationManager class. Adding to this pain was that RoleEnvironment.GetConfigurationSettingValue() would throw an exception if the value wasn’t set – unlike ConfigurationManager.AppSettings.
Now there is one class that can handle it all – CloudConfigurationManager. This class handles checking if the code is executing in a Windows Azure environment or not, and looks in the ServiceConfiguration file for the configuration setting. It also handles falling back to the application configuration (web.config or app.config) if the value isn’t in the ServiceConfiguration file.
As you can see there is a lot of new features and functionality available to those developing solutions that take advantage of the Windows Azure platform. I’ve only scratched the surface here. There are tons of new features in Windows Azure storage, the Service Management API, virtual networking, etc. I’ll be exploring more new features in upcoming articles. Exciting!!
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)