Share via


Getting Started with Windows Azure SQL Database Using the Windows Azure Management Portal

This article provides guidelines on how to sign up for Windows Azure SQL Database and how to get started creating SQL Database servers and databases.

Note

If you wish to contribute to this page, use the Edit tab at the top (sign-in required). If you wish to provide feedback for this documentation please either send e-mail to azuredocs@microsoft.com or use the Comment field at the bottom of this page (sign-in required).


Creating a Windows Azure Platform Subscription

To start using SQL Database, you must first purchase a Windows Azure Platform subscription by visiting the Windows Azure Platform Offers page or the Microsoft Online Services Customer Portal. Free trial is available.

Important: A single account may contain zero or more subscriptions. An account represents the way that you establish a billing relationship with Microsoft. A single Windows Azure Platform subscription can contain multiple services, such as Windows Azure, Windows Azure AppFabric, Windows Azure Marketplace and SQL Database.

Creating a subscription involves the following steps:

  1. Sign in. You must use your Windows Live ID to sign in.
  2. Create a profile. The first time you sign in, you create a profile to use with all of your subscriptions.
  3. Acquire a subscription.
  4. Activate a subscription.

For a step-by-step guide, see Acquire and Activate a Trial or Subscription: A Step-by-Step Guide.


Creating a SQL Database Server

After creating and activating your subscription, you can provision new SQL Database servers for the subscription at the Windows Azure Management Portal.

  1. Sign in at the Windows Azure Management Portal using a Windows Live ID account associated to the Windows Azure Platform subscription.

  2. The Home view is shown when you first log in. Click New Database Server or the Database button as highlighted in the following screenshot.

  3. On the Database view, expand Subscriptions and click the subscription that the server will be associated with. Make sure the status of the subscription is Ready. Click the server Create button highlighted in the following screenshot.

  4. On the first page of the Create Server wizard, choose a geographical region where the server will be located then click Next.

    Choose the closest region to avoid a bandwidth-based fee and achieve the best performance. For more information on bandwidth costs, see Accounts and Billing in SQL Database.

  5. On the next screen, enter a new administrator login name and password for the SQL Database server and then click Next. These credentials represent the server-level principal similar to the System Administrator (sa) login in SQL Server. This account will be used to access and manage the new SQL Database server.

    For more information on creating user-level logins see Managing Databases and Logins in SQL Database.

  6. The firewall rules page is shown next. In order to access the new SQL Database server outside the Windows Azure Management Portal, you must specify one or more firewall rules. The checkbox labeled Allow other Windows Azure services to access this server should be checked if you want to allow other Windows Azure services and applications to access your SQL Database Server. Click the Add button to add a firewall rule for each IP address ranges that will be permitted to access your new SQL Database server. After adding firewall rules for each IP address range, click Finish.

    Note: You can change the firewall rules later by clicking the server in the Windows Azure Management Portal and click clicking the Firewall Rules button in the server view.

  7. The server is created with a master database that contains the firewall rules. Proceed to the next section which describes creating a new database on the Windows Azure Management Portal.


Creating a new Database on a SQL Database Server

Once you have created your server, you can create your SQL Databases by using the Windows Azure Management Portal or connecting to the master database and running the CREATE DATABASE statement. A master database is created automatically with the SQL Database server. You must be connected to the master database whenever you use the CREATE DATABASE, ALTER DATABASE, or DROP DATABASE statements. If you do not specify a database in the connection string, you will be connected to the master database by default. An example connection string is provided in this section.

This section describes using the Windows Azure Management Portal to create a test database.

  1. Log into the Windows Azure Management Portal, select one of the servers associated to the subscription and click the database Create button.

  2. Enter the Database name, Edition, and Maximum size for the new database and then click OK.

    For more information on different database sizes and editions, see Accounts and Billing in SQL Database.

  3. SQL Database creates the new database according to your specifications as shown in the following screenshot.

    Each SQL Database server has a fully qualified unique domain name, such as servername.database.windows.net. The servername refers to the name of your SQL Database server. You can use the fully qualified DNS name to build connections strings for your database. The following are two example connection strings based on this example database...

    ADO.NET:

    Server=tcp:b8fiitc6yr.database.windows.net;Database=TestDB;User ID=MyAdmin@b8fiitc6yr;Password=;Trusted_Connection=False;Encrypt=True;

    ODBC:

    Driver={SQL Server Native Client 10.0};Server=tcp:b8fiitc6yr.database.windows.net;Database=TestDB;Uid=MyAdmin@b8fiitc6yr;Pwd=;Encrypt=yes;

  4. To test connectivity for a login, click the new database under the subscription or in the database list. Then click the Test Connectivity button to test connectivity using a login you created.

  5. On the Test Connectivity dialog, enter the login name and password that you want to test connectivity with. The click Connect. The dialog should indicate success as shown in the following screenshot.

    Note: You must enable the Allow other Windows Azure services to access this server firewall rule to use the test connectivity feature.

After you have created your SQL Database server, databases, and set the firewall rules, you can connect to your SQL Database by using the sqlcmd utility and the SQL Server 2008 R2 Management Studio. For more information, see Developing and Deploying with SQL Database.

An online database management tool is available on the Windows Azure Management Portal. It can be accessed by clicking a database and then clicking the Manage button on the Windows Azure Management Portal. For more information see MSDN documentation for the Database Manager for SQL Database.

Just like SQL Server, SQL Database allows you to create additional logins and users. For more information, see Managing Databases and Logins in SQL Database.

SQL Database also allows you to use a subset of the Transact-SQL query language to query a database and to insert, update, and delete data in tables in a database. For more information, see Transact-SQL Reference.

When you write applications for SQL Database, you can use one of the .NET Framework programming languages, which come with Visual Studio 2008 or later: Microsoft Visual Basic, Microsoft Visual C#, or Microsoft Visual C++. You can also use the ADO.NET data provider for SQL Server, the SQL Server 2008 Native Client ODBC driver, and the SQL Server 2008 Driver for PHP version 1.1. For more information, see Development Guide.


See Also

The authors of the original information contained in this article are Wesley McSwain, Selcin Turkarslan.