I'm having difficulties with connecting to my deployed database on Azure. I'm new to Azure, currently trial license. I have a web application created in ASP.NETCore C# with Visual Studio 2015 (still in debug phase). It's already deployed and running. I have a database attached to it and data can be saved with no issues.

However, I cannot connect to it in no way. That means that I cannot modify it and cannot apply migrations. I need to delete it from Azure portal and create a new one, then when I publish my app from VS everything works fine. Before, when I tested my app on a local server I applied migrations through console. setting up in appsettings appropriate connection string. Now when I copy a connection string from Azure it gives me an error. The same error as in SSMS open image I cannot ping to it, nor access through telnet. I used tracert and it stops here open image. In Azure I set a firewall to put through my ip adress as well as a maximum possible range. My port 1433 is tested and there is a connection according to grc.com.

It irritates me, because I cannot even open it in SSMS. How is this possible? Does anyone have an idea, what else can I do? Maybe I'm doing something wrong, in an official tutorial from Azure it looks so easy, but doesn't work for me. I'll be glad to see any ideas.

  • Hi, your SQL server is a Pass SQLserver or a SQL server machine on Azure? – Shui shengbao Dec 15 '16 at 8:56
  • Hi, it's a SQL server machine on Azure. I'm considering using a database form outside of Azure and see how this will work, however I'm very curious why the current solution doesn't work – miki9009 Dec 15 '16 at 12:48

According to your description, maybe you could check as the ways below:

1. Logon SQL Server on Azure VM.

Please ensure you could logon it in your server VM.

2. Check NSG inbound rule for the VM. If you want to be able to connect to SQL Server over the internet, you have to configure an inbound rule on the NSG for the port that your SQL Server instance is listing.

Notes: If you created a network security group on your subnet, you must open port 1433 on both the subnet’s and the VM’s Network Security Group.

3. Check ports in the Windows firewall.

Please ensure port 1433 is port to access.

Azure provides an article about how to connect to your SQL Server instance running on an Azure VM, maybe you could check according to the article steps by steps.


I still don't have an access to my Azure Database from SQL Server Object Explorer in Visual Studio and in SSMS, but I don't need that actually. What I wanted is to be able to apply migrations to my already deployed database. I cannot do this in my console anymore, because I still cannot connect to it, however I can add migrations to my project dotnet ef migrations add [migration name] and then when I publish my project through Visual Studio I need to check the box in settings "apply this migration on publish". So when I go to my webapp for the first time the migration is applied.

I spent 3 days wondering how to make a proper connection in order to apply migrations to my app and all I needed to do was to check a box...

  • Hi miki9009, after your edit it looks like you found a solution, would you mind to make it clear to invalidate my "Not an answer flag" I'd have to apologize for? The first version of your answer looked like a supplement to your question. – bummi Dec 16 '16 at 19:01
  • @miki9009 Was your issue resolved? – Shui shengbao Dec 19 '16 at 2:17
  • 1
    @Walter - MSFT, as I said, the biggest problem was that I cannot even modify tables in my database, because I cannot connect to it. It seems like there's some problem in connection between my PC and Azure, that I don't know how to resolve. Fortunately I can check a box (apply migrations) before publishing my project in visual studio and they'll be made when the app is published on the server – miki9009 Dec 29 '16 at 16:04
  • @bummi Sorry but I don't know what you mean. Could you elaborate it more? – miki9009 Dec 29 '16 at 16:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.