How To Create Azure SQL Database Using Azure Portal

Introduction

In this article, we will learn how to create Azure SQL Database using portal. There are database services available in azure portal.

Azure database services

  • Azure cosmos database is a globally distributed database service that elastically and independently scales throughout and storage.
  • Azure SQL Database is a relational database as a service (DaaS) based on the latest stable version of the Microsoft SQL Server database engine.
  • Azure Database for MySQL is fully managed MySQL database service for app developers.
  • Azure Database for PostgreSQL is relational database service based on the open-source Postgres database engine.

Step 1

If you don't have an Azure subscription, create an Azure free account before you begin.

Step 2

Sign in to the Azure portal with your Azure account.

Step 3

From the Azure portal menu, or from the Home page, select Create a resource.

Step 4

On Azure portal in the Search box, enter SQL Database. From the results list, choose SQL Databases.

Step 5

On the SQL Database section, choose Create SQL Database.

Step 6

On the Create SQL Database section provide the following information:

1. Subscription: Select the desired Azure Subscription.

2. Resource Group, For Resource group, select Create new, enter DatabaseResourceGroup. You could choose existing resource group if you created.

3. Database Name: A unique name is required. For Database name, enter Adventure.

4. Server: For Server, select Create new, and fill out the New Server form with the following values:

  • Server name: Enter adventure-db and add some characters for uniqueness. We can't provide an exact server name to use because server names must be globally unique for all servers in Azure, not just unique within a subscription. So, enter something like adventure-db, and the portal lets you know if it's available or not.
  • Location: Select a location from the dropdown list.
  • Authentication method: Select Use SQL authentication.
  • Server admin login: Enter administrator.
  • Password: Enter a password that meets requirements and enter it again in the Confirm password field.
  • Select OK.

5. Leave Want to use elastic pool set as No

6.Compute + Storage: Select configuration database Basic 2GB Storage

7. Backup storage redundancy set as: Go redundancy backup storage

8. After providing the information above, select Review + Create. Next validation page appears with Create button. You are done. You have created your first SQL Database.

How to set server firewall

1. After the database deployment completes, select SQL databases from the left-hand menu and then select Adventure on the SQL databases page. The overview page for your database opens. It displays the fully qualified server name (such as advanture-db.database.windows.net) and provides options for further configuration. You can also find the firewall settings by navigating directly to your server and selecting Networking under Security.

2. Copy the fully qualified server name. You will use it when you connect to your server and its databases in other quick starts. Select Set server firewall on the toolbar.

3. Set Public network access to Selected networks to reveal the virtual networks and firewall rules.

4. Choose Add your client IP to add your current IP address to a new, server-level, firewall rule. This rule can open Port 1433 for a single IP address or for a range of IP addresses. You can also configure firewall settings by choosing Add a firewall rule.

5. Select Save

How to query the database

Once your database is created, you can use the Query editor (preview) in the Azure portal to connect to the database and query data.

  1. In the portal, search for and select SQL databases, and then select your database from the list.
  2. On the page for your database, select Query editor (preview) in the left menu.
  3. Enter your server admin login information and select OK.

Enter the following query in the Query editor pane.

Create table Employee(
    Id int primary key identity(1,1),
    Name nvarchar(200),
    Position nvarchar(200),
    Salary money,
    Location nvarchar(200)
)
insert into Employee values('Arvind Kumar','Designer',30000,'Bangalore')
insert into Employee values('Bhargav Kumar','Developer',40000,'Bangalore')
insert into Employee values('Raghu Sharma','Software Engineer',50000,'Bangalore')
insert into Employee values('Sumit Kumar','Front End',45000,'Bangalore')
insert into Employee values('Priya Sharma','Tester',40000,'Bangalore')
select * from [dbo].[Employee]

How to connect database with local SQL Management instance

Step 1

Open SSMS.

Step 2

The Connect to Server dialog box appears. Enter the following information:

Setting Suggested value Description 
Server type Database engine Required value.
Server name The fully qualified server name Something like: advanture-db.database.windows.net.
Authentication SQL Server Authentication This tutorial uses SQL Authentication.
Login Server admin account user ID The user ID from the server admin account used to create the server.
Password Server admin account password The password from the server admin account used to create the server.


Step 3

Select Connect. The Object Explorer window opens.

Step 4

To view the database's objects, expand Databases and then expand your database node

Conclusion

Congratulations you have created your SQL Database using azure portal. This article provided a comprehensive guide on the Azure SQL Database. It also provided a brief overview of it and its features. It also highlighted some steps for creating and managing resources on the Azure Portal. 


Similar Articles