Azure SQL Database: How to Create a DB
This article walks you through the steps for creating a Windows Azure SQL Database using the Windows Azure Platform Management Portal. Before you can create a SQL Database, you must create and activate your Windows Azure Subscription, and create a SQL Database Server. For more information, see [[Getting Started with SQL Database using the Windows Azure Platform Management Portal|Getting Started with Windows Azure SQL Database]]. You can also create SQL Database using SQL Server Management Studio.
Once you have created your SQL Database server, you can create your SQL Database
databases by using the Windows Azure Platform 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.
To create a SQL Database
Sign in at the Windows Azure Platform Management Portal using a Windows Live ID account associated with the Windows Azure Platform subscription.
In the left pane, click Database.
In the left pane, expand Subscriptions, expand the subscription that the SQL Database server will be associate with, and then click the SQL
Azure server where you want the database created.
Click Create as highlighted in the following screenshot.
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 Windows Azure SQL Database .
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=myPassword;Encrypt=yes;
To test connectivity for a login, click the new database under the subscription or in the database list, and then click the Test Connectivity button to test connectivity using a login you created.
On the Test Connectivity dialog, enter the login name and password that you want to test connectivity with. The click Connect.
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 Windows Azure SQL Database.
An online database management tool is available on the Windows Azure Platform Management Portal . It can be accessed by clicking a database and then clicking the Manage button on the Windows Azure Platform Management Portal.
Just like SQL Server, SQL Database allows you to create additional logins and
users. For more information, see Managing Databases and Logins in Windows Azure 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
[[How to Create a Windows Azure SQL Database Server]]
[[Getting Started with Windows Azure SQL Database using the Windows Azure Platform Management Portal|Getting Started with Windows Azure SQL Database]]
[[Windows Azure and Windows Azure SQL Database Tutorials]]
[[How to Manage Windows Azure SQL Database Servers using Windows PowerShell]]
[[Windows Azure SQL Database TechNet Wiki Articles Index]]