How to Create a Windows Azure SQL Database

Part 1 of 4:

Creating a Windows Azure SQL Database

  1. Log in to your Windows Azure management portal.
  2. Click on the NEW button in the bottom left corner.
    Then, it will show you a wizard.
  3. Choose Data Services from the first pane, then select SQL Database.
  4. Select Quick Create.
    1. It will show a dialog, to enter name, select server and data center's region for your database.
  5. Enter the name for your database, and choose New SQL database server in the SERVER if you don't have any.
  6. Choose a login name which will be your username to access the database. Enter a strong password to meet the following requirements.
    1. The password must meet the following requirements:
      1. More than eight characters in length
      2. Does not contain all of the login name
      3. Contains characters from at least three of the following categories:
        -English uppercase characters (A through Z)
        -English lowercase characters (a through z)
        -Base 10 digits (0 through 9)
        -Non-alphanumeric characters (example: !, $, %)
  7. Click Create SQL Database. Then you will see the following process.
    When the process is completed, you will see your database name in "'all items"' list in management portal. Now your database is created successfully!
Part 2 of 4:

Allow your IP address for your client app to connect to the server

  1. Manage firewalls. To allow your client app to connect to your database, you need to add client pc's IP address to allowed list. To do so -
    1. Click on SQL Databases in management portal. You will see a list of current databases in your Management Portal.
  2. Click on Cars database.
  3. Click on Dashboard in menu.
  4. Click on 'Manage allowed IP addresses' link in Quick Glance.
  5. Click on Add to the Allowed IP Address against your current client IP Address
  6. Click on Save button in the bottom bar.
    1. Now you are done managing your database connectivity settings. You can now connect your database to your client app.
Part 3 of 4:

Make Some Changes to Database

  1. Add some table to the database. To do so -
    1. Click on Databases.
    2. Click on Cars database
    3. Click on 'Design your SQL database' link in Cars database management window.
      1. A new Window will open.
      2. Put your username and password you entered for your database in this window.
      3. Click on "Log On" button. Now you will see the SQL DATABASE Management Portal.
      4. Click on Design in the bottom left corner.
      5. Click on New Table to create a new table in database.
    4. Click on "Identity?" against column ID
    5. Make columns as shown in the image below.
    6. Click on Save.
      How to Create a Windows Azure SQL Database Picture 1
    7. Click on Data.
    8. Add some rows of data
    9. Click on Save.
Part 4 of 4:

Checking Database Connectivity

  1. Copy Connection String from your Cars database Dashboard. To do so -
    1. Go to Dashboard and click Show Connection Strings in Quick Glance.
    2. Copy the ADO.NET Connection String
      and replace the "default password" with the password your entered in credentials of database.
    3. Make a simple console application in Visual Studio and enter this code in the Main() function.
    4. Collapse | Copy Code | try
      {
      Console.WriteLine("Creating Connection");
      var conn = new SqlConnection(/* CONNECTION STRING HERE */ );
      var cmd = new SqlCommand("Select * From Manufacturers", conn);
      Console.WriteLine("Opening Connection!");
      conn.Open();
      Console.WriteLine("Connection Opened");
      Console.WriteLine("Executing Query");
      var result = cmd.ExecuteReader();
      Console.WriteLine("Query Executed!");
      Console.WriteLine("Manufacturers found in database:");
      while
      (result.Read())
      {
      object[] rowArr = new object[result.FieldCount];
      result.GetValues(rowArr);
      Console.WriteLine("t"+rowArr[1]);
      }
      Console.WriteLine("Closing Connection!");
      conn.Close();
      }
      catch (Exception ex)
      {
      Console.WriteLine("Error Occuredn"+ ex.Message);
      }
      Console.Read();
  2. Run the application.
    1. It gives the following output, which means that everything is running OK and the SQL query is run against the server successfully, returning the rows of data.
      How to Create a Windows Azure SQL Database Picture 2
4.5 ★ | 2 Vote

May be interested

  • How to Unlock SQL Server AccountPhoto of How to Unlock SQL Server Account
    have you lost or forgotten your sql server login? are you unable to access your sql server account? if you are an individual user in the sql server, you can contact your sa (system administrator) to reset a new password for you. but if you...
  • How to Connect to MySQL Using PHPPhoto of How to Connect to MySQL Using PHP
    if you already know some of the basics of writing php scripts, you may be ready to learn about a set of built-in php functions that allow you to connect to and manipulate a mysql database. if you do not already have a mysql server (most...
  • How to Learn PHP and MySQLPhoto of How to Learn PHP and MySQL
    php is one of the most widely-used programming languages on the internet, and it allows you to do much more than simple html. mysql allows you to easily create and modify databases on your server. used together, these tools can create...
  • How to Prevent SQL Injection in PHPPhoto of How to Prevent SQL Injection in PHP
    this wikihow teaches you how to prevent sql injection using prepared statements in php. sql injection is one of the most common vulnerabilities in web applications today. prepared statements use bound parameters and do not combine...
  • How to Create a Secure Session Management System in PHP and MySQLPhoto of How to Create a Secure Session Management System in PHP and MySQL
    this guide will show you how you can store your sessions securely in a mysql database. we will also encrypt all session data that goes into the database, which means if anyone manages to hack into the database all session data is encrypted...
  • How to Create a Table in MySQLPhoto of How to Create a Table in MySQL
    tables make up the structure of your mysql databases. tables contain the information that is entered into the database, and can be created to suit basically any data storage need. creating a table only takes a few minutes, especially if...