Create Azure SQL Database in Azure Portal
Hi all, Hope all are doing well!. So last week I showed you about how to create CI/CD pipeline for ASP.NET Web API application by using Azure DevOps starter. I am going to show you how to create the Azure SQL database for our created Web API. This is the second part of the deploy ASP.NET Core CRUD API by using the Azure CI/CD pipeline. So I am going to show you how to use the Azure Portal to create a cloud-based SQL database with just a few mouse clicks.
In this article, I will tell you,
- Introduction of Microsoft Azure SQL database
- Create an Azure SQL database
- Set up firewall rules for SQL DB server
Let’s get started,
Introduction of Microsoft SQL database
I will give some introduction about the Microsoft Azure SQL database before we start to create the Microsoft Azure SQL database. Microsoft Azure SQL Database is a managed cloud database for programmers/developers to develop their products easier due to less involvement in maintenance allowing the customer to concentrate on their products, because, most of the data maintenance or infrastructure is taken care of by the cloud service providers.
Few Advantages of a cloud database.
- Limitless Storage
- Lowered costs (due to reduced hardware overhead)
- Quick, easy and reliable disaster recovery
- Instant backups and restores for databases via the Azure Snapshot feature
Create an Azure SQL database
To start, First, you have to go to the Azure portal. Then select SQL Databases in Azure services and click the “Add” button. Then you can navigate to a page like the below picture.
First, select your free subscription and select your existing resource group, or also you can create a new resource group if you need it. By the way, I use the existing resource group which I created for deploy my API project in azure. Then Enter your DB name and select or create Server for your database.and choose your plan for compute + storage. Azure will default to the standard pricing tier, but you select a plan as you want. The basic pricing tier starts at $4.99/month for storage of up to 2GB. The Standard tier starts at $15/month for 250GB, and the Premium tier starts at $465/month for 500GB. Select Apply when you have made your decision.
If you want to create a new server you have to add server name, server admin login, and password for it. And we use these details for connection string when we connect our database into our API project.
After that then create your database. Then your deployment will complete after a few minutes. Then you can select your resource and it navigates to the database dashboard. And it will like the below picture.
Then you can check your database by navigating to query editor and try to log your database through SQL server authentication. Then you will get an error. Because you didn’t set firewall rules for the SQL database server. If you try to connect your DB to your project, then you will get an error as same. So now we have to set firewall rules for our to create SQL DB server.
Set up firewall rules for SQL DB server
So for set firewall rules, navigate to the DB dashboard and then click set server firewall on top of the dashboard.
Then you will navigate to the firewall settings page and then select the “Add Client IP” button. Then it will automatically add the IP address of the computer that you’re using, Then save it. Then try to login to SQL DB and then it will be a success.
Now you can see the database. Also now you can write any query in the query editor and check your SQL database in Azure.
Now we Created our Azure SQL database Successfully !!!
So Guys, That’s it for today and I think you learned something new from my article. I hope to meet you guys with the third part (final part) of this article.
Happy Coding & Good Luck All!!