During the development of a data-driven application, we can usually make do with a small database to store the data we’ll need while we develop. Once we move the application to staging and then to production we might want to store a larger amount of data or want high throughput.
If our solution requires the use of an Azure SQL database, then the smallest and cheapest database we can get is on the Basic pricing tier with 5 DTUs and 100 MB of storage. For this database, we will be paying around $5/month (USD).
We can see this when we are adding a new SQL Database and then specify the size:
While $5/month (USD) is not a considerable amount of money, we might simply want a cheaper alternative.
Fortunately, by following a series of simple steps we can provision a single Azure SQL database with 32 MB of data and 5 DTUs for free!
Mobile App
Rather than going to the portal and creating an Azure SQL database, we’ll instead first create a new Mobile App:
Once the Mobile App has been created, we’ll select it in the portal and click the “Quickstart” option in the Mobile App blade. This will bring up a number of different Quickstart templates to choose from:
Since we won’t complete each of the steps in Quickstart, it doesn’t really matter which template we choose, but for this demo we’ll select “Windows (C#)”.
This brings up the Quickstart blade where the first step is to “Connect a database”.
Clicking on Step 1 will bring up the Data Connections blade. Since we don’t yet have a data connection to choose from, we’ll click “Add” and on the “Add data connection” blade select “SQL Database” as the Type and click on “Configure required settings” to bring up the Database blade.
In order to configure the SQL Database, we’ll need to go through a couple of blades to create a new database and create a new database server:
With the database configured, we now get to specify the pricing tier. Upon clicking on “Pricing tier” option, in addition to seeing the same pricing tiers as before, we have now unlocked the Free pricing tier:
We can now “Apply” the Free pricing tier, “Select” the SQL Database we just configured and “OK” the new data connection we just created. This will begin the provisioning of the SQL Server and SQL Database. Once everything is provisioned, your resource group will show the four new resources:
At this point, you can remove the Mobile App and the App Service plan and keep the free database.
Limitations
This process will allow you to get up to one free Azure SQL database per region. If you attempt this same process to create another free database in the same region, you will receive the following error:
As you can see from the error message, you can create another free database in a different region or if you want the same region, you will need to use a different subscription.
Summary
While 32 MB of data is not much, it is usually enough when you are just getting started. Also, this being an Azure SQL database, you can easily scale up when you outgrow the 32 MB and 5 DTU limits.
I would love to hear how you make use of the free Azure SQL database. Please comment below and let me know how you used the database and if you ever needed to scale up.