Getting Started With Azure SQL - Part Two

Introduction

In the previous article, we saw how to create and connect Azure SQL server (server only) using Microsoft Azure Portal and SQL server Management Studio.

In this tutorial (Part Two), we will cover the following.

    1. Ways of & How to create Azure SQL Database
    2. How to connect Azure SQL Database using SQL Server Management Studio
If you have just directly landed on this article i.e. Part 2, I would recommend that you go through Part One for a better understanding of this cloud data-storage service.

Overview

SQL Database is a relational database service in the cloud based on Microsoft SQL Server engine. Features like delivering predictable performance, scalability, zero downtime, data security—are all with near-zero administration. You can focus on speedy application development, rather than dealing with virtual machines and infrastructure.

As it’s based on the SQL Server engine, Azure SQL Database supports almost all existing SQL Server tools, libraries and APIs, which makes it one of the best choices, when moving to the Cloud.

How to Create Azure SQL Database


There are different ways of creating Azure SQL Database.

  1. Using Microsoft Azure Portal
  2. Using SQL server Management Studio
  3. Programmatically by C# & PowerShell ( Will not cover this in tutorial )

For this tutorial, we will see the first two ways of creating Azure SQL Database.

Option 1 - Using Microsoft Azure Portal

Let's assume that you have an Azure Portal Account. If not, create your free Azure account.

Once you’re done with creating Azure account, let’s start,

Click New =>Databases =>SQLDatabase

SQLDatabase

Enter details under SQL Database blade,

  • Database Name - Name of Database you wish to create. It should be unique. I am entering it as ‘dbwithkasam’
  • Subscription - Free trial or your subscription.
  • Resource Group - You can create new or select existing.
  • SelectSource - This option allows to select source for database. We have three options,

    • BlankDatabase – Database created would be fresh blank.
    • Sample– It has three options to select from, as listed below in Image. 
    • Backup– To select any existing database backup

For this tutorial we will be going with ‘Blank database’ as an option for source,

SQLDatabase

SQLDatabase

  • Server

    This option will open Server Blade, listing all associated Azure SQL servers with your account along with an option to create new.

    We have already created Azure SQL server in Part 1 of this tutorial; we will go with the same i.e. ‘codewithkasam’.

SQLDatabase

Now comes the interesting part, Costing.

  • Pricing Tier

    By-default S2Standard tier is being selected for this option, as seen in the above image. Click on Pricing Tier for exploring more options with different configurations available, as seen below,

SQLDatabase

In this tutorial, we will be selecting ‘B Basic’ tier; Click Select => And Create from SQL Server blade.

Go to Azure SQL Database pricing details, for latest pricing updates.

SQLDatabase

That’s it! We are done. Below shown notification message will get displayed after successful creation,

SQLDatabase

AtSQL databases blade =>Click on Database Name newly created =>Overview

Details like server name,connections strings, Pricing Tier will be displayed here,

SQLDatabase

Connection string can also be seen by going,

AtSQL databasesblade =>Click on Database Name newly created =>Properties

SQLDatabase

Click on ‘Show database connection strings’

As shown in below image, connection string for ADO.NET (SQL authentication), ODBC including Node.js (SQL authentication), PHP, JDBC (SQL authentication) will be displayed.

Copy and ready to use in project!

SQLDatabase

Connect Azure SQL Database

For connecting Azure SQL database, open SSMS and connect to associate Azure SQL server. How to connect Azure SQL server, can be seen in Part One.

After successful login, newly created database can be seen below in object explorer,

SQLDatabase

As based on SQL server engine, you can operate Azure SQL database using SSMS, in a traditional way. You can add, delete, and update tables, Table-data, the way you want.

Seen below is sample of creating Table in Azure SQL database.

SQLDatabase

Option 2 - Using SQL Server management studio

Above steps, we are already connected to Azure SQL server, if not, above steps and get connected to Azure SQL server.

Open Databases =>SystemDatabases =>Rightclick on db‘master’ =>NewQuery

Write below SQL query, for creating new database. Below query will create new Azure SQL Database name, ‘TestDB1’. Click on Execute.

It will take a few minutes, and will display success message as shown below.

SQLDatabase

In portal, under SQL server blade, Click on overview. Under Databases section, you can view Azure SQL databases we created.

SQLDatabase

Click on ‘TestDB1’ to explore its properties,

SQLDatabase

Summary - By now we saw, how seamlessly and without any robust efforts, we can create Azure SQL database,using Azure portal and by using SSMS.

In next article, Part 3 we will be covering the following.

  • How to delete Azure SQL Server.
  •  How to delete SQL Database


Similar Articles