Microsoft Azure

How to Create a single database in Azure Portal

In this article, I will explain How to create a single database in Azure. We will use the Azure portal, a PowerShell script, or an Azure CLI script to create a single database in Azure SQL Database. We will then query the database using Query editor in the Azure portal.

A single database is the simplest and quickest option for Azure SQL Database. We manage a single database inside a server, which is within an azure resource group in a specified Azure region.

We can create a single database in the server or provisioned less compute tier. A purvey database is pre-allocated a determined amount of compute resources, including memory, CPU and uses one of two purchasing models.

Create a single database in Azure

Create a single database in Azure portal:
Sign in to the Azure portal

1- In the Azure search bar, enter azure sql and then select Azure SQL.

microsoft azure search bar

2- On the Azure SQL page, select + Add.

microsoft azure sql + add

3- In the select SQL deployment option window, choose the SQL databases tile, with Single database. Choose Create.

select sql deployment option

4- Create SQL database Basics tab under Project details,
Select the Azure Subscription
Under Resource group, click on Create new, type a resource group name (my-sql), and then select OK.

azure create sql database

5- Database details; enter a Database name (mydatabase).
For Server, click ok Create new.

azure create sql database

New Server

6- Server name – Type a name (sqlserver44)
Server admin login: Enter username (jamil).
Password – Type a password that meets requirements and type it again to confirm password.
Location – Choose a location (US) Central US.
Select OK.

azure create sql database new server

7- Record the server admin login & password so we can login to the server and then its databases. If you forget the login or password, we can get the login name or reset the password on the SQL server page after database creation. To open the SQL server page, choose the server name on the database Overview page.

Under Compute + storage, if you need to reconfigure the defaults, choose Configure database.

azure create sql database basic

8- On the Configure page, you can optionally:
After making any changes, select Apply.

azure create sql database standard

9- Select Next: Networking >.

azure create sql database basic

10- Networking tab, under Connectivity method, choose Public endpoint.
Choose Next: Additional settings >.

azure create sql database networking

11- Additional settings tab, in the Data source section, for Use existing data, choose Sample. Select Review + create

azure create sql database sample

12- Select Create.

azure create sql database create

Query the database

Once the database is created, we can use the built-in Query editor in the Azure portal to connect to the database & query the data.
13- In the portal, search for, select SQL databases, and then choose your database from the list.
Choose Query editor (preview) in the left menu.

azure sql database query editor

14- Type the server admin login information, and then select ok.

azure sql database query editor preview

15- Type the below query in the Query editor pane.

SQL Copy
SELECT TOP 20 pc.Name as CategoryName, p.name as ProductName
FROM SalesLT.ProductCategory pc
JOIN SalesLT.Product p
ON pc.productcategoryid = p.productcategoryid;

Choose Run, and then review the query results in the Results pane.
Close the Query editor page, and then select OK when prompted to discard your unsaved edits.

azure sql database query

16- Copy database server name.

azure sql database overview

To connect to use SSMS and query Azure SQL Database or Azure SQL Managed Instance

Connect to your database

In SSMS, connect to your server.

Important

A server listens on port 1433. The firewall must have this port open to connect to a server from behind a corporate firewall.

1- Open SQL Server Management Studio.

The Connect to Server window box appears
Server type – Database engine
Server name – type your SQL Database URL (example sqlserver44.database.windows.net)
Authentication – SQL Server Authentication
Login – username
Password – type your password
Select Connect The Object Explorer window opens.

sql server management studio connect

2- To view the database objects, expand the Databases and then expand your database node.

sql server management studio

Query data

3- In Object Explorer, right-click mydatabase and select New Query.

sql server management new query

4- In the query window, paste the below SQL query:
SQLCopy
SELECT pc.Name as CategoryName, p.name as ProductName
FROM [SalesLT].[ProductCategory] pc
JOIN [SalesLT].[Product] p
ON pc.productcategoryid = p.productcategoryid;

From the toolbar, choose Execute to run the query and then retrieve data from the Product and ProductCategory tables.

sql server management query

Improve Website Response using Traffic Manager

Jamil Parvez

Jamil Pervez works as a Network Administrator, based in Kuwait with a Primary focus on Microsoft technologies. Microsoft Certified MCSE, MCTP, MCITP, CCNP, CCIP, CCVP with 20 years of experience in administering Windows Servers, Exchange, VMWare, Veeam B&R, Veritas BackupExec.

Related Articles

Leave a Reply

Back to top button