Step 5: Create the SQL Azure Database

Creating the SQL Azure Database for the ECMA 2.0 with SQL Azure test lab includes the following:

  • Create the SQL Azure Database Server

  • Create the SQL Azure Database

  • Create the SQL Azure Database Table

  • Populate the SQL Azure Database

Create the SQL Azure Database Server

The first thing we need to do is to create the SQL Azure database server.

To Create the SQL Azure Database Server

  1. Log on to FIM1 as CORP\Administrator.

  2. Open Internet Explorer and type www.windowsazure.com in the address bar. Hit enter.

  3. On the Windows Azure site, log in to the Management Portal. This may require that you install Silverlight. If so, click install Silverlight and once that has finished, refresh the page.

  4. On the left, click SQL Databases. In the center, at the top, click SERVERS and then click Create a SQL Server.

    Create Azure DB 1

  5. On the Database server settings screen, enter sa_fim for the Login Name and then enter Pass1word$ for the password and password confirmation. Click the checkmark. This will take you back to a status screen and there should be a green checkmark under status, next to Started.

    Create Azure DB 3

Create the SQL Azure Database

Next, we will create the Azure database that will reside on the server we just created.

To Create the SQL Azure Database

  1. In the Management Portal, at the top, click Databases.

  2. Click Create a SQL Database. This will bring up the New SQL Database – Custom Create screen.

    Create Azure DB 2

  3. Under Name, enter Contoso. Use the drop-down under server to select the server that was created in the previous step. Click the checkmark. This will take you back to a status screen and there should be a green checkmark under status, next to Online.

    Create Azure DB 4

Create the SQL Azure Database Table

The next step is to create our database table.

To Create the SQL Azure Database Table

  1. In the Management Portal, at the bottom, click Manage. This will bring up a message saying that the IP address that the FIM1 server is using is not part of the firewall rules. It will ask if you wish to add it. Click Yes. You will then be asked if you would like to manage the Contoso database now. Click Yes.

  2. This will take you to the Management Portal for the SQL Database.

  3. Under USERNAME enter sa_fim.

  4. Under PASSWORD enter Pass1word$.

  5. Click Log On.

    Create Azure DB 5

  6. At the top, click New Query and past the following into the box and click Run.

    CREATE TABLE [dbo].[HR](
    [DatabaseID] [int] IDENTITY(1,1) NOT NULL,
    [FirstName] [char](20) NULL,
    [LastName] [char](30) NULL,
    [EMail] [nchar](30) NULL,
    [EmployeeID] [nchar](10) NULL,
    [FullName] [char](50) NULL,
    [AccountName] [char](20) NULL,
    
    CONSTRAINT [pkHR] PRIMARY KEY CLUSTERED ([DatabaseID] ASC)
    
    
    
    ) ON [PRIMARY]
    

    Create Azure DB 6

  7. This should complete successfully.

    Create Azure DB 7

Populate the SQL Azure Database

Finally we will populate our SQL Azure database with some data.

To Populate the SQL Azure Database

  1. In the Management Portal, at the top, click New Query and past the following into the box and click Run.

    INSERT INTO HR (FirstName, LastName, EMail, EmployeeID, FullName, AccountName) 
    VALUES ('John', 'Smith', 'jsmith@corp.contoso.com', '11255', 'John Smith', 'jsmith') 
    INSERT INTO HR (FirstName, LastName, EMail, EmployeeID, FullName, AccountName) 
    VALUES ('Jane', 'Doe', 'jdoe@corp.contoso.com', '11277', 'Jane Doe', 'jdoe')
    

    Create Azure DB 8

  2. This should complete successfully and say that 2 rows were affected.

  3. At this point, you can close Internet Explorer.

    Create Azure DB 9