Cloud Computing with Microsoft Azure SDS

Introduction

This article will introduce the Microsoft Azure service and
explore the SQL Data Services (SDS).

In general terms, Cloud Computing means interacting with a
service or operating system whose physical location is somewhere in the
internet cloud. This is one of the main benefits of Cloud Computing, that your
application can leverage someone else’s infrastructure. In the case of Azure, it
means running on a very vast array of machines hosted by Microsoft. As a DBA
or developer, this translates into the opportunity to use a very stable and a performance
oriented infrastructure without the management issues and problems of
maintaining it.

The Azure cloud consists of many computers linked together
to form a networking fabric. Microsoft manages the entire machine cloud fabric
and these management tasks are hidden from our consuming application. Our
applications will sit on top of this fabric, but not be aware of them. This is
similar to how a traditional ASPX web application sits on top of IIS but doesn’t
concern itself with the details of how the web server interacts with the
operating system.

In Cloud computing, we’re either utilizing a virtual server
system hosted in the cloud, or interacting with a service hosted in the cloud.
Azure is a cloud hosted service. We interact with it by writing applications
with SOAP or REST along with HTML and XML.

Azure is the foundation of Microsoft’s cloud solution. We
can think of it as the base operating system or service that we interact with.
The Azure provides a platform for hosting applications or services and storing
any user or system data required by it. We usually create Azure applications
with Visual Studio, but Ruby and Python can also be used.

There are additional add-ons available to develop with that
sit on top of Azure, such as Live Services, Dot Net Services, CRM Services,
Share Point, and SQL Data Services. Live Services exposes applications such as
Live ID and Live Messenger. The Dot Net Services layer provides an interface
for access control and workflow. Share Point and CRM Services are used to
create collaborative applications. SQL Data Services (SDS) exposes SQL Server
like data organization in the cloud. Pricing is not yet available for either
Azure or the add-on products mentioned.

SQL Data Services (SDS)

SQL Data Services sit on top of Azure and provide database features.
SDS is very much a work in progress. According to Microsoft, the final product
will be release sometime in the second half of 2009. With that said, TSQL is
not currently supported; instead, a version of LINQ is used to create queries.
However, TSQL should be available soon.

SQL Data Services supports several common data types,
including String, Date Time, Boolean, Numeric, and Binary. There is also a
timestamp applied to each data change. These data types hold our data called
“Entities”. The Entities reside in a table structure called a “Container”.
Containers are created inside a database system called an “Authority”. A
single Authority (database) can hold a maximum of 1000 Containers (tables).
Each Container can hold a maximum of 100 MB of non BLOB entities, or 1 GB of
BLOB data. Maximum data Entity size is 2 MB for non BLOB and 100 MB for a
BLOB. Keep in mind that SDS is under construction at the time of this writing,
and these values are subject to change. These objects are created and managed
by writing code to call either SOAP or REST web services.

Getting Started

To get started with Microsoft Azure and SQL Data Service,
Register for a CTP (Community Technology Preview, meaning BETA) login at http://www.microsoft.com/azure/register.mspx
. Once you have a login, download the Visual Studio Tool Kit and SDK (Software
Development Kit).

The Tool Kit requires a database so it can mimic the Azure
fabric on your desktop. This allows for local application development and
debugging. By default, the tool kit will install SQL Express, if you already
have the full SQL product installed, it can be used instead by calling
“DSInit.exe /sqlinstance: <SQL Server instance>” from the Windows Azure
SDK command prompt. The Command Prompt is one of the tools installed with the
SQL Server Data Services SDK. Another tool, SSDS Explorer, is a lightweight graphical
tool for creating objects and generating the XML code used to create them.

SSDS Explorer

The SSDS Explorer can be found under the Microsoft SQL Data
Services SDK program files folder once the SDK is installed. Starting the tool
will prompt for your Azure login and password. Pressing the Authority button
will generate the code needed to create an Authority (database).

The SSDS Explorer

I’ve entered “mycloud1” as my database name. Next click
POST and the Authority will be created. We can verify the creation by clicking
the Query button. The following code will be returned showing our newly
created authority:


<s:Authority>
<s:Id>mycloud1</s:Id>
<s:Version>132957344</s:Version>

To
work with our new database, change the Address from https://data.database.windows.net/v1/
to https://mycloud1.data.database.windows.net/v1/ . We’re
now working inside the mycloud1 space.

To
create a new Container (Table) inside mycloud1, click the Container button. I’ve
created a new table called “mycontainer1” with the following code and pressed the
POST button.


<s:Id>mycontainer1</s:Id>
</s:Container>

To
create Entities (data) inside the new Container, change the Address from https://mycloud1.data.database.windows.net/v1/
to https://mycloud1.data.database.windows.net/v1/mycontainer1 . We’re now working inside
the “mycontainer1” space. Think of the Address bar as the “name space” that has
focus.

REST and SOAP

The
Explorer is handy, but SSDS is really meant to be managed by writing code using
either REST or SOAP. In overly simple terms, REST is lightweight but will
perform most needed functions. SOAP is more complex but feature rich. An example
of creating a “Container” using REST is available from the following Microsoft
web site: http://msdn.microsoft.com/en-us/library/cc512400.aspx
. In general terms, the Container code generated by the explorer is defined as
a sting:


const string ContainerTemplate = @”<s:Container =’http://schemas.microsoft.com/sitka/2008/03/’>
<s:Id>{0}</s:Id>
</s:Container>”;

Next,
we define a POST event, which is what the POST button in the Explorer did for
us previously:


request.Method = HttpPostMethod;
UTF8Encoding encoding = new UTF8Encoding();
request.ContentLength = encoding.GetByteCount(requestPayload);
request.ContentType = ssdsContentType;

Lastly we send the request:


using (Stream reqStm = request.GetRequestStream()) {
reqStm.Write(encoding.GetBytes(requestPayload), 0,
encoding.GetByteCount(requestPayload)); }

On
the MSDN site there are examples for C#, Java, Ruby, and VB performing data
UPDATES, DELETES, and other queries.

Conclusion

Microsoft
SQL Server Data Services sits on top of Azure and provides structured data
storage in the cloud. Several common data types are supported and a version of
TSQL will soon be available. We work with SDS by writing SOAP or REST code.

»


See All Articles by Columnist
Don Schlichting

Don Schlichting
Don Schlichting
Don Schlichting is a Microsoft MSCE, MCDBA and an Oracle Certified Associate. Working at Professional Control Corporation as the IT Director,.

Get the Free Newsletter!

Subscribe to Cloud Insider for top news, trends & analysis

Latest Articles