Archive for December, 2011

In the previous post, we were talking about creating servers, databases and tables using the Windows Azure portal. Now we will talk about developing it using ADO.NET.

First of all what do we need to start the development?

Your username, password, server name and database name.

Create the first connection string to the master database to be able to create other databases like the following:

            SqlConnectionStringBuilder constrbuilder;
            constrbuilder = new SqlConnectionStringBuilder();
            constrbuilder.DataSource = dataSource;
            constrbuilder.InitialCatalog = “master”;
            constrbuilder.Encrypt = true;
            constrbuilder.TrustServerCertificate = false;
            constrbuilder.UserID = userName;
            constrbuilder.Password = password;

Now you are able to create a new database like the one we did in the previous post but using the ASO.NET.

SqlConnection con = new SqlConnection(connString1Builder.ToString());
SqlCommand cmd = con.CreateCommand();
cmd.CommandText = string.Format(“CREATE DATABASE {0}”, databasename);

as the previous example as long as you have the data required to access the database you can normally do anything like the SQL server

            SqlConnection con = new SqlConnection(constrbuilder.ToString());
            SqlCommand cmd = con.CreateCommand();

I may like the windows azure storage more than the SQL Azure because it is cheaper and more scalable but I think the main advantage of SQL Azure is the relational database. Well it is a structured storage like the normal SQL Server. In this post we will create a database online using the Windows Azure portal.

First of all go to and click on sign in to the management portal, enter your email and password o login into your account.

Down at the right most you will find the Database icon just click on it

If you don’t have a server created already on your account you have to create one to do so, in the middle you will 3 things you can do:

  1. Create a new windows azure subscription
  2. Create a new SQL Azure Server
  3. Create a new SQL Azure Database

We will go for the second one “Create a new SQL Azure Server”

Follow the instructions that appear first of all define the place where do you want your database to be placed. In other words, there are 6 azure datacenters worldwide, so for developers you have to decide which one of these datacenters is the best of you depending on its location(the nearest one for your target people).

After this click on next, another window will appear for the administration of the server you have to define the administrator name and password.

The last step is:

you have to set rules for the firewall for those who can access your database with fixed IP addresses.

Finally you have your server created.

If you click on your server created at the right most you will see all your subscription information and if any database was created.

Now let’s move for the next step, is creating your database. At the top most you will find all what you can do to, from creating a new database, dropping the database and so on…

Now we will press on Create Database “The Blue one”.

You have to enter the database now, the edition and its size.

Now you have your Database created, you can see it, check its status and get all the information required if you click on it.

After you click on it you will find at the top most what you can do on the portal for your database created.

In this example we will manage the database, so click on manage at the top most like in the figure.

You will find yourself navigated to another web page in which it asks you for a user and a password

After entering the username and password, you will see the following page where you can create tables and do what you want online on the portal. Now click on “New Table” at the top most like in the following figure

Now you can add columns as much as you need and set their values, define which one is the primary key and so on…