This SQL Database tutorial shows you how to create a first SQL database in just a few minutes with sample data in the Azure preview portal. You'll learn how to:
You'll need an Azure account and subscription before you start. If you don't have one, sign up for a free trial.
This SQL Database tutorial covers setting up a database using Microsoft's relational database management service in the cloud, Azure SQL Database. Another option is to run SQL Server on an Azure Virtual Machine. See Understanding Azure SQL Database and SQL Server in Azure VMs for a quick comparison, or you can see Provision a SQL server virtual machine to get started with a virtual machine.
Click New > Data + Storage > SQL Database.
The SQL Database settings blade that appears is where you'll set up the server and database details.
A SQL database in Azure lives on a database server. A server can host multiple databases. As you set up a database, you can also create and set up the server that will host it, or you can use one that was created earlier. We'll set up a new one.
Under Server click Configure required settings, and then click Create a new server.
In the New server blade, type a Server Name that's unique throughout Azure and easy to remember. You'll need this name later when you connect and work with your database.
Type a Server admin login that's easy to remember (we use AdventureAdmin). Then type a secure Password and type it again in Confirm password.
Leave Create V12 Server (latest update) set to Yes to use the latest features. The Location determines the data center region where your server is created.
Click OK to go back to SQL Database blade.
The database and server aren't created yet. This happens after the next step, where you choose to create the database from the AdventureWorks sample and confirm settings.
In the SQL Database blade, click Select source and then click Sample.
You go back to the SQL Database blade, where Select sample now shows AdventureWorks LT [V12]. Click Create to kick off creation of the server and database.
For this quick how-to, we didn't change the settings for Pricing tier, Collation, and Resource group. You can change the pricing tier of a database and scale up and down at any time, with no downtime. See SQL Database Pricing and SQL database pricing tiers to learn more. The collation of a database can't be changed once you set it up here. See Collation and Unicode Support for details about collation. See Azure Resource Manager Overview for details about Azure resource groups.
You jump back to the Azure Startboard, where a tile shows progress until the database is created and it's online. You can also click Browse all and then click SQL Databases to confirm the database is online.
Congratulations! You now have a SQL database running in the cloud. You're almost finished. There's one key step left. You need to create a rule on the database server so you can connect to the database.
You need to set up a firewall rule on the server that allows connections from your client computer's IP address so you can work with the database. This not only helps make sure you can connect, it's a great way to see the area where you can get other details about your SQL servers in Azure.
Click Browse all, scroll down and then click SQL servers, and then click the name of the server you created earlier from the list of SQL servers.
In the database properties blade that appears to the right, click Settings and then click Firewall from the list.
The Firewall settings show your current Client IP address.
Click Add Client IP to have Azure create a rule for that IP address, and then click Save.
Your Client IP address is likely to change from time to time, and you may not be able to access your server until you create a new firewall rule. You can check your IP address using Bing, and then add a single IP address or a range of IP addresses. See How to configure firewall settings for details.
Now that you've completed this SQL Database tutorial and created a database with some sample data, you're ready to explore using your favorite tools.
If you're familiar with Transact-SQL and SQL Server Management Studio, learn how to Connect and query a SQL database with SSMS.
If you know Excel, learn how to Connect to SQL database with Excel.
If you're ready to start coding, see Connect and query your SQL database with C# and Using SQL database from .NET (C#). See the Quick start code samples to SQL Database for Node.js, Python, Ruby, Java, PHP and C++ samples and how-to's in addition to C#.
If you want to move your on-premises SQL Server databases to Azure, see Migrating a database to Azure SQL Database to learn more.