Follow the steps to install and connect to Microsoft's cloud database and access it from an application
SQL Azure Database is Microsoft's cloud-based version of SQL Server. SQL Azure is much like an on-premises SQL Server, providing a cloud-based relational database that you can connect to and many familiar SQL Server management and development tools. I'll explain how to get started using SQL Azure Database and how to connect to SQL Azure and use it as database back end for your applications.
At Your Service
The first step to using SQL Azure Database is to set up a SQL Azure account. The initial CTPs for SQL Azure allowed free access. The CTP expired in November 2009, when Microsoft replaced it with the live version of SQL Azure. There are two different levels of SQL Azure accounts. SQL Azure Web Edition supports a maximum of 1GB of data and costs $9.99 per month. SQL Azure Business Edition includes up to 10GB of data and costs $99.99 per month. You can obtain a SQL Azure account by going to sql.azure.com, then completing the registration process.
After signing up for the SQL Azure service, you log in to manage the SQL Azure database by going to http://sql.azure.com, then logging in using your Windows Live ID. When you initially set up your SQL Azure service, you're prompted to enter an administrative login and password that must meet strong password requirements. After you provide the administrative account information, you'll see the SQL Azure management interface that Figure 1 shows.

The SQL Azure Management window enables you to perform two essential tasks: Create databases and open client connections to the SQL Azure server. When you initially connect, you need to pay special attention to the SQL Azure server name, as you'll need that to establish client connections to the database.
The first task in getting started with SQL Azure is to create a database. You do so by selecting the Databases tab, then clicking the Create Database button. You'll then see a dialog box that lets you name the database and specify a maximum size. I was able to choose either 1GB or 10GB. For my initial testing I created a 1GB pubs database.
After creating the database, you can get the connection string for the database by checking the radio box in front of the data, then clicking the Connection Strings button that you can see near the bottom of Figure 1. This is important because unlike an on-premises SQL Server system, you cannot change databases after connecting to SQL Azure. You need to establish a new connection to connect to a different database. Listing 1 shows an example of the SQL Azure connection strings from ADO.NET and ODBC.
Listing 1: SQL Azure connection strings
ADO.NET:
Server=tcp:gvlxq1rlrw.database.windows.net;Database=pubs;<br>User ID=mikeo;Password=myPassword;Trusted_Connection=False ODBC:
Driver=\\{SQL Server Native Client 10.0\\};Server=tcp:gvlxq1rlrw.database<br>.windows.net;Database=pubs;<br>Uid=mikeo@gvlxq1rlrw;Pwd=myPassword Next you need to enable the firewall. You can't connect to your SQL Azure database until you explicitly enable a range of IP addresses that the client systems will use to connect. To add new firewall entries, select the Firewall Settings tab, then click the Add Record button. Doing so will display the Custom Firewall Settings dialog box, in which you enter a range of IP addresses that may connect to your SQL Azure database. One point to note: If you're using Network Address Translation (NAT), you'll need to use your system's public IP address—not the internal IP address of your client system. SQL Azure helps you with this by displaying your current external (public) IP address on the Custom Firewall Settings dialog box.
Connecting to the Cloud
SQL Azure supports client connection using the native SQL Server Tabular Data Stream (TDS) protocol, and you can connect to SQL Azure using SQL Server Management Studio (SSMS). However, it's important to know that Object Explorer doesn't work because it requires access to the sys.configurations table, which isn't accessible in SQL Azure. Instead you need to perform SQL Azure management using Query Editor. To connect to SQL Azure, open SSMS, then on the Connect dialog box that runs automatically, click Cancel to connect Object Explorer to the database. This will open a blank SSMS window. Click New Query, then fill out the connection dialog box, as Figure 2 shows.


