WINDOWS AZURE

Friday, August 14, 2009

An application runs in the cloud, uses services provided by the cloud, or both, some kind of application platform is required. Viewed broadly, an application platform can be thought of as anything that provides developer-accessible services for creating applications. In the local, on-premises Windows world, for example, this includes technologies such as the .NET Framework, SQL Server, and more. To let applications exploit the cloud, cloud application platforms must also exist. And because there are a variety of ways for applications to use cloud services, different kinds of cloud platforms are useful in different situations.
Microsoft’s Azure Services Platform is a group of cloud technologies, each providing a specific set of services to application developers. As Figure 1 shows, the Azure Services Platform can be used both by applications running in the cloud and by applications running on local systems.

Figure 1: The Azure Services Platform supports applications running in the cloud and on local systems.
The components of the Azure Services Platform can be used by local applications running on a variety of systems, including various flavors of Windows, mobile devices, and others. Those components include:
• Windows Azure: Provides a Windows-based environment for running applications and storing data on servers in Microsoft data centers.
• Microsoft .NET Services: Offers distributed infrastructure services to cloud-based and local applications.
• Microsoft SQL Services: Provides data services in the cloud based on SQL Server.
• Live Services: Through the Live Framework, provides access to data from Microsoft’s Live applications and others. The Live Framework also allows synchronizing this data across desktops and devices, finding and downloading applications, and more.
Each component of the Azure Services Platform has its own role to play. This overview describes all four, first at a high level, then in a bit more detail. While none of them are yet final—details and more might change before their initial release—it’s not too early to start understanding this new set of platform technologies.
WINDOWS AZURE
At a high level, Windows Azure is simple to understand: It’s a platform for running Windows applications and storing their data in the cloud. Figure 2 shows its main components.

Figure 2: Windows Azure provides Windows-based compute and storage services for cloud applications.
As the figure suggests, Windows Azure runs on a large number of machines, all located in Microsoft data centers and accessible via the Internet. A common Windows Azure fabric knits this plethora of processing power into a unified whole. Windows Azure compute and storage services are built on top of this fabric.
The Windows Azure compute service is based, of course, on Windows. For the initial availability of this service, a Community Technology Preview (CTP) made public in the fall of 2008, Microsoft allowed Windows Azure to run only applications built on the .NET Framework. The company has announced plans to support unmanaged code as well, i.e., applications that aren’t built on the .NET Framework, on Windows Azure in 2009.
In the CTP version of Windows Azure, developers can create .NET-based software such as ASP.NET applications and Windows Communication Foundation (WCF) services. To do this, they can use C# and other .NET languages, along with traditional development tools such as Visual Studio 2008. And while many developers are likely to use this initial version of Windows Azure to create Web applications, the platform also supports background processes that run independently—it’s not solely a Web platform.
Both Windows Azure applications and on-premises applications can access the Windows Azure storage service, and both do it in the same way: using a RESTful approach. The underlying data store is not Microsoft SQL Server, however. In fact, Windows Azure storage isn’t a relational system, and its query language isn’t SQL. Because it’s primarily designed to support applications built on Windows Azure, it provides simpler, more scalable kinds of storage. Accordingly, it allows storing binary large objects (blobs), provides queues for communication between components of Windows Azure applications, and even offers a form of tables with a straightforward query language.
.NET Services
Microsoft .NET Services are a set of Microsoft-hosted, highly scalable, developer-oriented services that provide key building blocks required by many cloud-based and cloud-aware applications. Much like the .NET Framework provides higher-level class libraries that make developers more productive, Microsoft .NET Services enables developers to focus on their application logic rather than building and deploying their own cloud-based infrastructure services.
Windows Azure
Windows Azure is the cloud services operating system that serves as the development, service hosting, and service management environment for the Windows Azure Platform. Windows Azure provides developers with on-demand compute and storage to host, scale, and manage Internet or cloud applications. and services on the Internet in Microsoft data centers.
Windows Azure supports a consistent development experience through its integration with Visual Studio. In the early stages of CTP, .NET managed applications built using Visual Studio will be supported. Windows Azure is an open platform that will support both Microsoft and non-Microsoft languages and environments. Windows Azure welcomes third-party tools and languages such as Eclipse, Ruby, PHP, and Python.
Microsoft Cloud Computing Tools
Windows Azure Tools for Microsoft Visual Studio extend Visual Studio 2008 and Visual Studio 2010 Beta 1 to enable the creation, building, debugging, running, and packaging of scalable Web applications and services on Windows Azure.
SQL Azure
Microsoft SQL Azure extends the capabilities of Microsoft SQL Server into the cloud as a Web-based, distributed relational database. It provides Web services that enable relational queries, search, and data synchronization with mobile users, remote offices and business partners. It can store and retrieve structured, semi-structured, and unstructured data.
Web Developers
The Windows Azure Platform is built to help you create, deploy, and distribute Web services and applications on the Internet. Web developers can create applications that run in a browser or build and publish your own set of services by harnessing the flexibility of SOAP, REST, and XML; use your current skill set on a range of Microsoft and non-Microsoft tools on a standards-based platform; create and share results quickly; and extend solutions to a millions of Windows Liv customers.
Corporate Developers
With the Windows Azure Platform, you can augment your company’s software solutions and connect with your partners’ systems more quickly and easily than ever before. You can create, test, and deploy software by using the skills, tools, and frameworks that you already know best –— without additional training or costly capital investments.
independent Software Vendors ISVs
Azure is a comprehensive services platform that ISVs can use to take full advantage of the reach and scalability of the Internet without sacrificing their investments in existing applications. Because it is an extension of the Microsoft platform, developers are able to use Azure to create .NET-based applications that run in Microsoft data centers and use cloud-based services that extend the value of on-premises software.
System Integrators and Value-Added Partners
As the hub of the Microsoft software-plus-services initiative, the Windows Azure Platform affords system integrators and value-added partners an opportunity to both streamline their own infrastructure investments and help their clients to do the same.
Business
The Windows Azure Platform provides cloud-based computing and services designed to make Internet-scale computing easier for developers in corporate and enterprise settings. These services decrease the capital and operational costs of maintaining existing applications or planning for new initiatives by using Microsoft’s infrastructure in a pay-as-you-use pricing model.
Example:
Creating the Project
Open Visual Studio 2008 and create a Web Cloud Service project.

Updating Service Definition

The first step to do is to update the service definition and service configuration files to include the storage account. Edit your service definition file found in the Guestbook project and enter these settings

AccountName
This specifies your Windows Azure account name
ccountSharedKey
The shared key used to authenticate requests made against your Windows Azure account
TableStorageEndpoint
The base URI of the table storage service
Updating Service Configuration
After setting the properties in our service definition, we need to set the values of those properties in our service configuration file found in the Guestbook project

AccountName
devstoreaccount1
AccountSharedKey
Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==
TableStorageEndpoint
http://127.0.0.1:10002/
All the values reflect your local development storage and nothing in the cloud. The development storage supports only the above fixed account and is same for everyone.
We should be able to test our azure application locally in the local development storage before deploying it to the cloud. Testing your application locally will also help you to debug your applications.
Creating the Table Schema
Defining the table schema is as easy as creating classes. The idea here is to create a class, where the class name corresponds to the table name and the properties correspond to the table properties. The local development storage environment uses ADO.NET to create tables in the local environment, whereas this is not needed when we host our application in the cloud.
Creating these classes are made simple by using the StorageClient library provided in the Windows Azure SDK

You can add the StorageClient project to our Guestbook solution or just reference the library.

Below is our class which represents the Guestbook table:

As you can see in the above screenshot, our class GuestDataModel inherits TableStorageEntity. This TableStorageEntity class is available in the StorageClient library and defines some of the properties such as partition key and row key that is required for each entity in the table.

The GuestDataModel consists of three properties:

1) Message
2) Name
3) Url

And our simple constructor where we initialize the partition key and row key:

As the local storage uses ADO.NET we are going to create class GuestDataServiceContext which inherits from TableStorageDataServiceContext from the StorageClient library. The TableStorageDataServiceContext represents the runtime context of our ADO.NET service.

Now having the data model and the data context in place, its very easy to query our storage and perform the usual insert, delete operations

We create a GuestDataSource which is going to help interact with the data context and insert, delete and get all the GuestDataModel entities

As you can see, it's pretty straight forward. Below are insert and delete methods:

Creating our Tables
We saw how to insert, delete and get all our entities from the table using a simple data source, but where are we actually creating the table?

We are going to create the table on the first request to the website which can be done by adding the appropriate code into the global application class.
Executing this guestbook sample
Executing this guestbook sample is just as same as executing a normal asp.net application! Hit F5 and Visual Studio 2008 will take care of everything - from starting the local development storage, creating the tables and debugging the application.

Download Code

By
Usama Wahab Khan & Atif Shahzad

share this post
Share to Facebook Share to Twitter Share to Google+ Share to Stumble Upon Share to Evernote Share to Blogger Share to Email Share to Yahoo Messenger More...

0 comments: