How to connect Azure SQL database with Visual Studio 2019 without connection errors [Error Number: 10060]

Chin, Max @ Global D&T 1 Reputation point
2022-12-27T02:42:01.19+00:00

I'm trying to connect to my Microsoft Azure SQL database to Visual Studio 2019. I've tried signing in using SQL Server Authentication, included the password and proceed to "Connect". However, I'm unable to connect and it returns with the error number 10060.

These are the settings (including) in Azure which I configured before opening Visual Studio 2019.

Under set firewall - Public Network, selected "selected networks"
Enabled allow Azure services and resources to access this server.
Additional information

Error number 10060 means the SQL Server client cannot connect to the server
The same error appears when I tried connecting to Azure Data Studio.
The server I am trying to connect to is a Development server.

Azure SQL Database
{count} votes

3 answers

Sort by: Most helpful
  1. TP 124.7K Reputation points Volunteer Moderator
    2022-12-27T03:05:48.093+00:00

    Hi

    Did you add Firewall rule for your client PC's public ip address? Sign in to the portal from the same machine you want to connect from, open up your Azure SQL server, Networking, scroll down under Firewall rules and click "Add your client IPv4 address (xx.xx.xx.xx)" or similar, then click Save button at the bottom. After the change is applied, try to connect from Visual Studio.

    -TP

    0 comments No comments

  2. Chin, Max @ Global D&T 1 Reputation point
    2022-12-27T04:09:22.927+00:00

    Hi

    I have added the firewall rule and click "Add your client IPv4 address (xx.xx.xx.xx)", clicked "Save" and proceeded to restart Visual Studio 2019. I tried logging in and it returns with the exact error message.

    Could this be caused by internal restrictions set by the company? Also, I am unable access Azure Active Directory. These are the credentials I copied when accessing Azure Active Directory.

    { "shellProps": { "sessionId": "d05e3a1d4a784280a0bda7f21fc92393", "extName": "Microsoft_AAD_IAM", "contentName": "ActiveDirectoryMenuBlade", "code": 403 }, "error": { "message": "No access", "code": 403 }}

    0 comments No comments

  3. Bjoern Peters 8,921 Reputation points
    2022-12-27T13:31:48.497+00:00

    Hi @Chin, Max @ Global D&T

    If the machine you are running VS2019 on is your regular company machine... and you are trying to connect via a company network or VPN... yes, all the policies your company applied to your network apply to your connection and maybe stop those attempts.

    Maybe the company has also applied a local firewall that does not allow that external traffic on several ports.
    If you have the opportunity to use your private PC... then try this. If it works... get in contact with the network team of your company and ask them.

    On the other hand... which endpoint of your Azure SQL DB did you use... is there an internal or a public endpoint? Is public access set to "allowed" on your SQL server?
    Did you already try this tutorial to troubleshoot your connection? Maybe this tutorial helps you to set up a connection...

    https://learn.microsoft.com/en-us/azure/azure-sql/database/connect-query-ssms?view=azuresql

    I hope my answer is helpful to you,

    Your
    Bjoern Peters

    If the reply was helpful, please upvote and/or accept it as an answer, as this helps others in the community with similar questions. Thanks!

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.