SQL Azure to Developers: Some Basic Concepts


In this post we will focus on overview of SQL Azure along with a first look on SQL Azure Management Portal. Essentially we will cover in this part

  • What is Cloud Database
  • What is SQL Azure
  • Create and Manage Database in SQL Azure
  • Fire Wall in SQL Azure

What is Cloud Database?

For a developer a better perspective on database is always better and it helps to write different layers of application in effective and efficient way. Database in cloud is new buzz and very much appreciative technology. There are two words constitute CLOUD DATABASE. We are very much aware of term DATABASE whereas CLOUD may be newer or ambiguous to us.

In very broader term, Cloud can be termed as next generation of Internet. On a normal scenario you find on which server your database is residing. You have very minute level administrative control on database server and you have a physical sense of database server. Whereas imagine if you are not aware of where your database is residing? , you access and perform all operation on database via Internet. Scalability, Manageability and all other administration task on database is performed by some third party. You only pay for the amount of data residing on the database provided by third party. You work on use and pay model. In that case you can say database is in cloud.

There are many cloud service providers like Microsoft, Amazon etc. to name a few. All vendors do have their own cloud servicing model and pricing. Microsoft cloud platform is known as Windows Azure. Essentially Windows Azure is cloud operating system offered by Microsoft. As part of Windows Azure, there are five services offered by Microsoft

  1. Windows Azure
  2. SQL Azure
  3. Office 365
  4. App Fabric and Caching services
  5. Marketplace

In this three part article, we are going to focus our discussion to SQL Azure. We will focus on essential aspects need to know about SQL Azure as dot net developer. To be very precise on SQL Azure, we can say “SQL Server in cloud is known as SQL Azure “. When you have chosen to create relational database in Microsoft data center then you can say your database is in cloud or in SQL Azure.

In this article, we will cover

  • What is SQL Azure?
  • A first look on SQL Azure Management portal
  • SQL Azure Database edition
  • Firewall setting for SQL Azure

What is SQL Azure?




SQL Azure is cloud based service from Microsoft. It allows you to create your Database in one of the Microsoft Data center. In a very generic statement we can say SQL Azure allows creating Database on the cloud. It provides highly available database. It is based on SQL Server. It supports built in Fault tolerance and no physical administration is required. It supports TSQL and SSMS.

Advantage of using SQL Azure

  • In built Fault tolerance support
  • No Physical Administration required
  • Very high availability
  • Multitenant
  • Pay as you go pricing
  • Support of TSQL
  • Highly scalable

We have done enough of theoretical discussion, now let us login to SQL Azure portal and create a database in the cloud.

Create and Manage Database in SQL Azure

To create Database in SQL Azure, You need to follow below steps


Login SQL Azure portal with your live credential


Step 2

Click on SQL Azure tab and select Project



Click on the project. In this case project name is debugmode. After clicking on project, you will get listed the entire database created in your SQL Azure account.

Here in this account there are two database already created. They are master and student database. Master database is default database created by SQL Azure.


Step 4

Click on Create Database


Step 5

Give the name of Database. Select the edition as Web or Business and specify the max size of database.


Step 6

After that click on Create you can see on Databases tab that Demo1 database has been created.



Different types of SQL Azure Database edition

At time of creating Database you might have seen, there were two Database editions


Web Edition Relational Database includes:

  • Up to 5 GB of T-SQL based relational database
  • Self-managed DB, auto high availability and fault tolerance
  • Support existing tools like Visual Studio, SSMS, SSIS, BCP
  • Best suited for Web application, Departmental custom apps

Business Edition DB includes:

  • Up to 150 GB of T-SQL based relational database*
  • Self-managed DB, auto high availability and fault tolerance
  • Additional features in the future like auto-partition, CLR, fanouts etc
  • Support existing tools like Visual Studio, SSMS, SSIS, BCP
  • Best suited for Saas ISV apps, custom Web application, Departmental apps

While creating Database in SQL Azure you can choose among either of two options


If we choose Web Edition then Maximum size we can choose is 5 GB


If we choose Business Edition then Maximum size we can choose is 150 GB

SQL Azure portal is having very effective Silverlight based user interactive UI and many more operations can be performed through the UI. There is new database manager and it allows us to perform operations at table and row level.

Now we can perform many more operations through Database option of new Windows azure portal.

  • Create a database
  • Create/ delete a table
  • Create/edit/delete rows of table.
  • Create/edit stored procedure
  • Create/edit views
  • Create / execute queries etc. . . .

You can manage database using Data Base Manager.


Accept given term and conditions and click Ok. you will get popup asking password to connect to database. Provide password and click on Connect.


After logon you will get Mange user interface as below,




And in left hand panel you will have options as below,


For more on this watch the video of the post.

Firewall in SQL Azure

In this way, you can perform almost all the basic operations from new SQL Azure Data Base Manager.

SQL Azure provides security via Firewall. By default Database created on SQL Azure is blocked by firewall for the security reason. Any try to external access or access from any other Azure application is blocked by firewall.


Image taken from MSDN

Connection Strings

You can copy Connection string from SQL Azure portal as well.


Connecting from Local system

When we want to connect SQL Azure portal from network system or local system then we need to configure firewall at local system. We need to create an exception for port 1433 at local firewall

Connecting from Internet

The entire request to connect to SQL Azure from Internet is blocked by SQL Azure firewall. When a request comes from Internet

  1. SQL Azure checks the IP address of system making the request
  2. f IP address is in between the range of IP address set as firewall rule of SQL Azure portal then connection get established.

Firewall rules can be Added, Updated and Deleted in two ways

  1. Using SQL Azure Portal
  2. Using SQL Azure API

Manipulating Firewall rules using SQL Azure Portal

After login to Windows Azure portal, click on Database option and select Database server from left tab. You can see firewall rules listed there.


A new rule can be added by clicking on Add button.


To connect from other Windows Azure application for same subscription check the check box


An existing firewall rules can be edited and deleted also by selecting Edit and delete option respectively.


In this part we discussed various elementary concepts of cloud database and SQL Azure. In further part we will go deep to understand other essential concepts needed to know as developer.

Consuming JSON in Windows 8 Metro style Application using WinJS

In this post I will discuss way of consuming JSON service in Windows 8 metro style application. In this post,

  • Metro app is created using HTML 5 and Service is being consumed using WinJS
  • Service is created service using WCF and REST is on service using webHttpBinding.

Since creating simple REST Service returning JSON is not main focus of this post, so I will show creation WCF REST Service returning JSON in later part of this post.

Consuming JSON using WinJS

We need to consume service in HTML 5 Metro application. Very first let us design HTML page


<!DOCTYPE html>
<meta charset="utf-8" />
<!-- WinJS references -->
<link rel="stylesheet" href="/winjs/css/ui-dark.css" />
<script src="/winjs/js/base.js"></script>
<script src="/winjs/js/wwaapp.js"></script>
<!-- HelloWorldJavaScript references -->
<link rel="stylesheet" href="/css/default.css" />
<script src="/js/default.js"></script>
<label >First Number</label>
<input id="TextboxFirstNumber" type="text" />
<label >Second Number</label>
<input id="TextboxSecondNumber" type="text" />
<br />
<button id="ButtonAdd">+</button>
<br />
<span id="SpanResult" />

I have put a button and two text boxes. User will input number to be added in textboxes and on click event of the button service would get called.

In JS file to make call to REST Service returning JSON, we need to make call using WinJS.xhr.


In above snippet

  1. url is URL of REST Service
  2. Using JSON.parse we are parsing returned text
  3. ResultSpan is span in which result is being displayed.

Putting all code together as below,


(function () {
'use strict';

WinJS.Application.onmainwindowactivated = function (e) {
if (e.detail.kind === Windows.ApplicationModel.Activation.ActivationKind.launch) {


function Calculator() {
var Number1 = document.getElementById('TextboxFirstNumber');
var Number2 = document.getElementById('TextboxSecondNumber');
var ResultSpan = document.getElementById('SpanResult');
var ButtonToAdd = document.getElementById('ButtonAdd');
ButtonToAdd.addEventListener('click', function () {
var baseURl = "http://test2dj8.cloudapp.net/Service1.svc/rest/add/";
var url = baseURl+Number1.value+"/"+Number2.value;
WinJS.xhr({ url: url }).then(function (r) {
var result = JSON.parse(r.responseText);
ResultSpan.innerHTML = result;



Creating simple Add Service

To start with let us create a WCF REST Service returning JSON as below. There is one operation contact named Add in the service and that is taking two strings as input parameters and returning integer.

public interface IService2

ResponseFormat = WebMessageFormat.Json
int Add(string  Number1, string Number2);


Service is implemented as below,

using System;

namespace MultipleBindingWCF

public class Service1 : IService2

public int Add(string Number1, string Number2)
int num1 = Convert.ToInt32(Number1);
int num2 = Convert.ToInt32(Number2);
return num1 + num2;


Next in this section we need to configure service. We need to configure service webHttpBinding to eanble it as REST Service. So in Web.Config we need to do the below changes.

<?xml version="1.0"?>
<compilation debug="true" targetFramework="4.0" />
<behavior name ="servicebehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
<behavior name="restbehavior">
<endpoint name ="RESTEndPoint"
contract ="MultipleBindingWCF.IService2"
binding ="webHttpBinding"
address ="rest"
behaviorConfiguration ="restbehavior"/>
<modules runAllManagedModulesForAllRequests="true"/>

After configuring, Service is ready for hosting. After hosting consume service in Windows 8 Metro application.

I hope this post is useful. Thanks for reading.