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
Log on to FIM1 as CORP\Administrator.
Open Internet Explorer and type www.windowsazure.com in the address bar. Hit enter.
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.
On the left, click SQL Databases. In the center, at the top, click SERVERS and then click Create a SQL Server.
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 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
In the Management Portal, at the top, click Databases.
Click Create a SQL Database. This will bring up the New SQL Database – Custom Create screen.
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 the SQL Azure Database Table
The next step is to create our database table.
To Create the SQL Azure Database Table
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.
This will take you to the Management Portal for the SQL Database.
Under USERNAME enter sa_fim.
Under PASSWORD enter Pass1word$.
Click Log On.
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]
This should complete successfully.
Populate the SQL Azure Database
Finally we will populate our SQL Azure database with some data.
To Populate the SQL Azure Database
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')
This should complete successfully and say that 2 rows were affected.
At this point, you can close Internet Explorer.