In this article, we will take a look at the step-by-step to create a new Azure SQL database using the Azure portal. We will also configure the Firewall to allow us accessing this new database. Lastly, we will verify that we can access it through the Internet using Management Studio.
Step-by-step creating a new SQL database on Azure
Please note that the following steps require us to have an Azure subscription. If we don’t have the subscription yet, we need to create it first by navigating to www.azure.com and following the instructions provided by Microsoft. Once we complete the process, we will see the Azure portal, which is a web interface where we can create different resources, including the Azure SQL database.
Step 1. In the Azure portal, click on the portal menu icon, which is the three horizontal lines in the top left corner of the screen. Here we will see different kinds of resources listed in the menu, as well as SQL databases.
Step 2. Hover on the SQL databases and click on the green plus button. Notice that a form shows up to allow us to provide relevant information about the database that we are going to create.
Figure 1. The button to create an Azure SQL database
Project details section
Step 3. For this demonstration, select Free Trial for the Subscription field. Then, create a new Resource group named GotIt. The Resource group is a container, sort of like a folder, that allows us to set permissions and see summaries of the cost of our resources.
Figure 2. Project details section
Database details section
Step 4. In the Database details section, fill the Database name with GotItAzureSqlDatabase. Notice that there are rules for the database name as shown in the green check marks next to the Database name text box.
Figure 3. Specifying the database name
Step 5. Create a new Server by clicking the Create new button under the Select a server dropdown. Notice that a new area shows up on the right side of the screen, and we need to fill some information, as shown in Figure 4 below.
Figure 4. Azure create a database server
To connect to the database server, we will need to access it by its name (azure-sql-dbsvr.database.windows.net) using sqladmin and the password we specified for this login. For the Location dropdown, choose the region closest to our geographic area or follow our legal requirements.
Step 6. Click the OK button.
Step 7. For the “Want to use SQL elastic pool?“ option, select No (see Figure 5).
Step 8. For the Compute + storage, click the Configure database button to configure the pricing tier and the size of the database we would like to use.
Figure 5. Database details section
For this demonstration purposes, let’s select the Basic option and limit the database size to 1 GB.
Figure 6. Selecting the pricing tier and the database size
Step 8. Click the Apply button.
Step 9. Click the Review + create button.
Step 10. Review the summary of the new database that we’re going to create. Then, click the Create button to proceed.
Figure 7. Reviewing the summary of the new database
Step 11. Wait for a few seconds while our database is being deployed. Following is the screenshot after the deployment is complete.
Figure 8. The deployment is complete
Once the deployment is complete, let’s navigate to Home > All resources. We will be able to find the server and the database we have created before.
Figure 9. All resources
Then, we need to configure the Firewall and manage the IP addresses in the SQL server resource. We will grant ourselves access to the Azure database server. To do that, follow the below steps:
Step 1. Click on the azure-sql-dbsvr link.
Step 2. Click the Firewalls and virtual networks under the Security section.
Step 3. Notice that Azure automatically detects our IP address. Name the rule and enter our IP address (or the range). We can also click the Add client IP button at the toolbar menu to automatically fill the rule name and the IP address. When finished, click the Save button.
Figure 10. Configuring the Firewall
Connect to the database using Management
Finally, let’s connect to our new database using the SQL Server Management Studio (SSMS). Open our SSMS and enter the details to connect to our SQL server.
Figure 11. Azure SQL login
Once we click Connect, the Object Explorer on the left side should attempt a connection to our Azure SQL server. Expand the Database folder and confirm that the GotItAzureSqlDatabase is listed under this folder.
Figure 12. Accessing the newly created Azure SQL database
Instant livechat to an Expert!
Most of the time, the problem you will need to solve will be more complex than a simple method. If you want to save hours of research and frustration, try our live SQLExpert service!
Our SQLQuerychat Experts are available 24/7 to answer any questions you may have. We guarantee a connection within 30 seconds and a customized solution within 20 minutes.