This article explains how to create and connect Azure SQL database in the Azure portal.
First, we need to log into the Azure Portal with our Azure credentials. Then we need to create an Azure SQL database in the Azure portal.
Click on “Create a resource” on the left side menu and it will open an “Azure Marketplace”. There, we can see the list of services. Click “Databases” then click on the “SQL Database”.
Create a SQL database
After clicking the “SQL Database”, it will open another section. There, we need to provide the basic information about our database like Database name, Storage Space, Server name, etc.
Database name : The valid name of our SQL Database ( We have given the Database name as “AzureSQLDB” ).
Subscription : We can select our Azure subscription for SQL Database creation.
Resource group : We can create a new resource group or choose from an existing one ( We have selected our existing resource group as “WebAppAzureSql” ).
Select source : We select Blank database ( This will create a blank database ). The following Select source categories are available in the SQL Database.
- Blank database – This will create a blank database.
- AdventureWorksLT – This will generate an AdventureWorksLT sample schema.
- Backup : Create a new database from an existing backup.
Under the server, we need to configure required settings.
- Server name : Any globally unique name we can give which will store our database information.
- Server admin login : Create our server admin name for future access.
- Password & Confirm Password : Create our server admin password for future access.
- Location : Choose an available location that will be more suitable for our requirement.
Once we enter all the “Server” details then Click on “Select”.
Pricing tier : Select an appropriate pricing tier for our requirement.
Collation : Create a name for the Collation (Collation defines the rules that sort and compare the data and cannot be changed after the database creation ).
Click on “Create” to provision the database.
Database provisioned successfully!! Go to the Dashboard and Click on the Sql Database ( “AzureSqlDB” ).
Now open the details page of SQL database ( “Overview” ). Here, we can see the Server name and other created details. We can access the SQL Database through this Server name in Azure Portal & Local MSSQL.
Create a server-level firewall rule
We need to setup a firewall rule for accessing our Azure Sql database in Azure Portal. So the SQL Database service creates a firewall at the server-level that prevents external applications and tools from connecting to the server. If we not set up any firewall rule in Azure SQL database portal, then we will get the following error.
Setup Firewall Rule
Click on the “Set server Firewall” in the Overview Section.
The “Client IP address” automatically fetched into the Firewall Setting. We just copy the IP Address and Add the START IP & END IP Section (This will add based on more than one IP address ). Set a “RULE NAME” of our Firewall. Once it’s all done then the information saves automatically into the firewall rule section.
SQL Database Login in Azure Portal
Click on the “Query editor ( preview)” and Click on the “Login” and it will display a Login portal for accessing our Azure SQL Database in Azure. So give or appropriate database credential into it. Once it’s done Click on “OK” button.
It will open our Azure Sql Database Query Editor window with Database details.
Accessing through our Local “Microsoft SQL Server Management Studio”.
You can download other ASP.NET Core & Azure source codes from MSDN Code, using the link, mentioned below.
In this article, we are going to create and connect Azure SQL database to the Azure portal. I hope this article is useful for all Azure beginners & experts.