Blog Post

Connecting to Azure SQL Database

,

Recently I created my first Azure SQL Database. But now I need to connect to it.

You can connect using any number of tools. We can actually see several options by going back to our Azure Portal. Select the SQL Databases list, a specific SQL Database, and then the Quick Start option. (It looks like a broken cloud to me.)

ConnectAzureSQLDatabase1

Personally my tool of choice is SSMS. You can either follow the link show in the quick start menu or follow this one. I should point out that SSMS 2016 is free to download and use can can connect back to SQL 2008 (well actually 2000 but no guarantees that everything will work correctly).

Now install SSMS .. I’ll wait.

So now that SSMS is installed the next thing we need is the server name to connect to.

One of the properties of the SQL Database is the Server Name.

ConnectAzureSQLDatabase2

Unfortunately with a long name it’s abbreviated (it’s what you called it + “.database.windows.net” if that helps) and I haven’t figured out a way to copy it directly. What I did do is take a look at the connection strings and copy one of them.

ConnectAzureSQLDatabase3

Driver={SQL Server Native Client 11.0};

Server=tcp:myfirstserverinthecloud.database.windows.net,1433;

Database=MyFirstDatabaseInTheCloud;

Uid=sqlstudent144@myfirstserverinthecloud;

Pwd={your_password_here};Encrypt=yes;

TrustServerCertificate=no;Connection Timeout=30;

Enter that server name into a normal Object Explorer or Query Window connection window. Use the user name and password that you set up as your administrator. (There is of course a way to create other logins and I’m sure I’ll go into that at a later date.)

ConnectAzureSQLDatabase4

However the first time you hit Connect you will get an error.

ConnectAzureSQLDatabase5

I tried signing in and using the form above to create my new firewall rule but kept getting an authentication error. That being the case I went a different route.

First I go to the properties of my server, then to the firewall settings, type in the IP(range) and save.

ConnectAzureSQLDatabase6

Note: You can remove an IP(range) by hitting the ellipsis (…) and selecting delete. You do need to make sure to hit SAVE afterwards though.

Now that my IP is in place I can connect with no problems!

ConnectAzureSQLDatabase8

Filed under: Cloud, SQL Database, SQLServerPedia Syndication Tagged: Azure, SQL Database

Rate

You rated this post out of 5. Change rating

Share

Share

Rate

You rated this post out of 5. Change rating