Up until now, we have been talking mostly about
the Windows Azure platform in general. One important piece of Windows
Azure is SQL Azure. SQL Azure is not a default install of SQL
Server running inside a virtual machine on the public Internet. While it
may be tempting to think of it this way, it’s not correct. SQL Azure is
a flavor of the traditional Microsoft SQL Server integrated within the
Windows Azure platform. The end result is a cloud-based relational
database service that offers enterprise-class availability, scalability,
and security and is self-healing.
1. Understanding SQL Azure
With SQL Azure, you can, with a click of a
button, provision and deploy relational databases solutions. These
solutions come with manageability, high availability, scalability, and a
familiar development model out of the box. SQL Azure database abstracts
the logical administration from the physical administration. With
respect to database administration, you continue to administer
databases, logins, users, and roles, but Microsoft administers the
physical hardware, such as hard drives, servers, and storage. For
example, you will not find any command or statements that involve the
disk in SQL Azure. Commands like xp_fixeddrives
do not
exist in the SQL Azure world, since Microsoft takes care of everything
to do with disk provisioning and usage. This can also been seen within
the CREATE DATABASE
statement. It has been simplified to the following syntax convention:
CREATE DATABASE database_name
{
(<edition_options> [, ...n])
}
<edition_options> ::=
{
(MAXSIZE = {1 | 5 | 10 | 20 | 30 | 40 | 50} GB)
|(EDITION = {'web' | 'business'})
}
A DBA should not worry so much about job
security, because there is still plenty to manage. Even though we no
longer are concerned with the physical environment, we will still be
managing your applications with respect to security, query tuning, index
management, and everything that’s logical. Using SQL Azure, we won’t be
concerned with high availability or disaster recovery, because a SQL
Azure database is automatically replicated to three different areas
within the Microsoft datacenters.
The SQL Azure platform also manages load
balancing, and in case of a server failure, it fails over transparently.
Patching and upgrading of the server are all done automatically and
transparent for us. This may sound like the holy grail of database
servers. In some scenarios, it is, and in others, not so much. SQL Azure
has a sweet spot, and it revolves around these core scenarios:
Web applications: The cloud and
Windows Azure specifically is a prime scenario for web application
hosting. With SQL Azure as a relational database store, application
developers can store transactions, content, and streaming media—all in a
highly available and fault-tolerant environment.
Departmental applications:
SQL Azure is a great target for Tier 2, Tier 3, and Microsoft Access
applications and for those applications that use SQL Server Express
edition. SQL Azure provides an excellent opportunity to organize these
various smaller applications into one place. This also makes it easier
to audit and control access to the content.
Data hubs: Consider the scenario
where you have remote sales force staff members querying catalogs and
creating orders on their phones or laptops. These data need to be
uploaded to a corporate server, and fresh product data needs to be sent
from corporate to our remote employees. With SQL Azure and the Sync
Framework, you can create sync between the remote employee’s phone or
laptop, a SQL Azure database and the on-premise database.
Independent software vendor software plus services:
Software vendors can write hosted software solutions without the
concern of building out infrastructure to support it. Microsoft’s Azure
platform is not only about you writing your own applications for your
own business needs. There is an online marketplace established where you
can write applications and sell them or subscribe to real-time
information feeds from commercial data providers and leverage this
information in your own application.
2. Getting Started
To sign up for Azure or to leverage the free trial offer check out the following website: www.microsoft.com/windowsazure
.
The free trial requires the use of a credit card in case you go over your allocated time or disk space allowance.
Tip
Other offers not requiring a credit card pop up occasionally. The best
thing to capture these would be to do a web search for something like
“Windows Azure Free No Credit Card”. Be careful that the web site you
find is from Microsoft.com.
If you click the Buy button on the Windows Azure web page, you will be presented with three offers:
- Pay as you go: Pay as you go is self-explanatory; you only pay while you are using computing power or disk space.
- Subscription: If you want to save more money and make a
six-month commitment to the platform, you can check out the reduced cost
by looking at the subscriptions.
- Member offers: Special deals for people
who are MSDN subscribers. In some cases, if you have MSDN already, you
may have free access to Azure for a given duration.
Note
When you sign up for Azure, you will need a Windows Live ID. Live ID is
a single sign-on service developed by Microsoft. It was formally known
as Microsoft Wallet and Microsoft Passport. Existing Hotmail and MSN
users automatically have Windows IDs associated with their accounts. If
you do not use Hotmail or MSN, you will have to create a Windows Live ID
at www.live.com
.
As you make your way through the registration
pages, you will be asked for a subscription type. In Azure,
subscriptions are the billing boundary. Within a subscription, there is
an account owner and a service administrator. These can be assigned to
different Windows Live IDs, or to the same one. In general, the account
owner will be responsible for the billing, whereas the service
administrator is responsible for provisioning and managing the technical
piece of Azure (i.e., deploying applications, creating SQL Azure
databases, etc.). If you are just kicking the tires of Azure, you will
probably use the same Live ID account for all of these accounts.
Assuming you have subscribed to Azure, there are
two main web portals to note. Account owners will be interested in the
Microsoft Online Services Customer Portal (MOSCP); see http://mocp.microsoftonline.com
.
This web site will show you the subscriptions you are currently using
and an option to purchase more services and subscriptions. The MOSCP is
shown in Figure 1.
Figure 1. Microsoft Online Services Customer Portal
Service administrators and those wishing to do something technical with Azure will leverage the Management Portal (https://windows.azure.com
).
This web site is the primary portal for creating and managing anything
Azure related: SQL Azure databases, Windows Azure Compute and Storage,
deploying applications, and so on. This portal is shown in Figure 2.
Figure 2. Windows Azure Management Portal
To get started with SQL Azure, we create a SQL
Azure Server. A SQL Azure Server is a logical grouping of databases and
acts as the central administrative point. Each SQL Azure Server has a
fully qualified domain name, which gets created when you create a new
server. This name is in the form servername.database.windows.net
. The server name is automatically generated for you, and you will not be able to change this name.
Let’s go ahead and create a new SQL Azure
Server. If we click the New Database Server button on the Management
Portal, the Database node will be displayed. From this node, we can
either create a new SQL Azure Server or create a new SQL Azure Database.
On the left-hand side of the portal, you will see a list of the
subscriptions the currently logged in Windows ID has assigned to it. If
you are using the free trial, you may only see one subscription. To
create a database, we need to first create the SQL Azure Server. If you
click the Create a new SQL Azure Server button, you will be presented
with the dialog shown in Figure 3.
Figure 3. SQL Azure Create Server dialog
When we create a new SQL Azure Server, it’s
bound to a subscription. The subscription drives the price and all that
monetary good stuff. Once we select a subscription, we are asked in what
region we want the server to be placed. This depends on where the
majority of the users who are accessing this instance of SQL Azure will
be. Our options for this location include, North Central US, South
Central US, North Europe, West Europe, East Asia, and Southeast Asia.
The next page will ask for us for an administrator login and password.
This is similar to the sa
user found in on-premise SQL Server.
SQL Azure was developed with security in mind.
By default, there is no external access to any of the databases that you
create. The next page will ask you to define firewall rules to enable
access to your SQL Azure server. By default, there are no rules. Figure 4
has been populated with a few sample rules to depict how you may want
to enable certain scenarios like access from your home network.
Figure 4. Firewall rules page of the SQL Azure Create Server dialog
When you click the Finish
button, your SQL Azure Server will be created. Information about the
server can be displayed by clicking the server name under the
Subscriptions tab in the Management Portal. You will notice that there
is already a master
database created for us. The Properties
tab on the right side of the screen shows important information about
your new SQL Azure Server. An example of this information is shown in Figure 5.
Figure 5. Properties panel of a SQL Azure Server within the Management Portal
From the example, the SQL Azure Server is called wzoi2cq3ut
.
One of the big advantages with SQL Azure is that it uses Tabular Data
Stream (TDS) over the TCP/IP protocol. This is the same TDS protocol
that is used by on-premise SQL Server. Thus, if we have an existing
application that wants to leverage SQL Azure, all that is needed is to
change the server name in the connection string from the on-premise name
to the fully qualified DNS name of the SQL Azure Server.
Note
Before you connect to the SQL Azure Server from your location, be sure
to click the Test Connectivity button in the Management Portal. If your
IP isn’t defined within the firewall IP range, it will fail to connect.
Leveraging TDS over TCP/IP
also means that we can connect and manage SQL Azure databases using
familiar tools, including SQLCMD and SQL Server Management Studio 2008
R2 and above.