This post details the steps I took to create a new SQL Server instance on Azure and connect to it in Visual Studio.
It was a very simple process and beats the heck out of installing a instance of SQL Server on my own PC which to this day still has one of the most cumbersome installers so any chance to avoid that is a big win!
This post assumes you already have an Azure account setup and starts from the account overview
1. Create a resource
Click the Create a resource button on the top right of the page
2. Create SQL Database
On the Create a resource page select “Databases” from the Categories menu on the left then click “SQL Database”
3.Apply Free Tier
If this is for a hobby project like me, apply the free offer which gives you a lifetime of 100,000 vCore seconds and 32GB of data per month for free!
4. Set Subscription and Resource Group
I selected the subscription I created when I created my Azure account and I added a resource with the name of the app I’m creating the DB for.
5. Set DB Name
Set the name of the DB. This will be the name of the initial database created on your server.
6. Create New Server
Under the Server drop down, click “Create new”
Give your server a unique name
I set my authentication method to “Use Both” and set my Azure account as admin and added a server admin login to make it easier to connect from other applications. Be sure to save this password somewhere.
7. Set Limit Behavior
Set what you want to happen when you reach your free tier limit if you applied that.
For me, I don’t want any surprise charges so I set it to Auto-Pause when it reaches its limits.
8. Create
There are several other settings but I left them as is for now and hit the create button.
It took about 2 min to complete the deployment. When it was done I navigated to the resource
9. Set Firewall
Out of the box, the new server blocks all incoming connections so, to start developing with it, I added my local IP as an allowed IP address.
10. Connect To Server In Visual Studio
If you are logged into Visual Studio with the same Microsoft account as your Azure account, your new server should show up in the Cloud Explorer. From there you can open the database in the SQL Server Object Explorer and its all profit from here!