In this blog post, I am going to go through the steps to create an Azure SQL Database using the Azure Portal. I will also go through the steps on how to connect to the database after it has been created.
What is an Azure SQL Database
A Microsoft Azure SQL Database is a fully managed database service. As the name suggests it is provided by Microsoft and is available on Azure. The beauty of it being fully managed is you do not need to worry about the underlying software. That means no OS patching and no SQL patching. This is all done by Microsoft.
Another good point with regards to the management of the Azure SQL Database is the fact that you can still use the tools you are familiar with, aka SQL Server Management Studio (SSMS).
Create the Database
Navigate to the Azure Portal htts://portal.azure.com
Click on the green + and search for SQL Database.
Click on SQL Database
In this blade enter a Name for your database. Choose the Subscription you would like the database to be in and then either create a new Resource group or choose an existing one. Next, you can choose a Source This allows you to either use some demo data, a blank database or restore from a backup.
Now click on Server. In the new blade, we have to configure what SQL server this database will use. If this is the first database you are setting up the New server blade will appear.
Enter a globally unique name for the SQL Server, an Admin login, and Password. Finally chose the Location you would like the SQL server to reside in and then click Select
Select if you would like to use an Elastic Pool and then click on Pricing Tier. In the new blade. Click on the tier you require and then click Apply. For this guide, I have chosen Basic.
Back in the SQL Database blade the last section you can edit is Collation. For this guide, I am just leaving it as the default. You can change it if needed.
To finish the creation click on Create
After some time the Database will be created. Navigate to SQL Databases. This can be done via using the shortcuts on the left, or by click on All Services and searching for SQL Databases.
Click on your newly created database.
We now need to add some extra security to our new database. To do this click on Set Server Firewall
In this blade enter a Rule Name, Start IP and End IP in this guide I am just using my IP address. You can use your own.
By doing this you are locking down your Azure SQL Server to only be accessible via your IP address.
Once you have entered your firewall rules click on Save
Once the save has completed, click OK in the pop up box. And then close the Firewall settings blade.
You have now created an Azure SQL Database, but how do you connect to it?
Connecting to your Azure SQL Database
To connect to your Azure SQL Database you will need to use SQL Server Management Studio (SSMS). If you do not have it installed you can download it from https://docs.microsoft.com/en-us/sql/ssms/download-sql-server-management-studio-ssms?view=sql-server-2017
When you have opened SSMS you will be presented with a Connect to Server box.
In this box, you will need to enter the Azure SQL Server name, Username, and Password you created earlier.
If you can not remember the SQL Server Name, you can find it back in the Azure Portal on the SQL DB Blade.
Once you have entered all of the information in the connect to server box click Connect
You are now connected to your Azure SQL Server and are able to use it just like you were connected to an on-premises SQL server.
And that’s it, you have now created an Azure SQL DB and connected to it.
Thanks for reading and I hope you found this article helpful, if you have any questions please leave a comment or reach out via social media.