Connection Error Between Azure SQL DB with the codebase.

SHASWATA DAS 55 Reputation points
2024-05-21T04:17:12.86+00:00

I have created a SQL DB in the azure portal, setup it's server and crate a database table using the azure Data studio.

Now I setup a Microsoft Entra ID and add my IP for the smooth connection.

Now when I want to make a connection with my DB, I am facing the issue -
Server running on http://localhost:8080

Database connection failed: ConnectionError

at /Users/shaswatadas/Documents/React Project/authentication-app-by-azure/node_modules/mssql/lib/tedious/connection-pool.js:85:17

at Connection.onConnect (/Users/shaswatadas/Documents/React Project/authentication-app-by-azure/node_modules/tedious/lib/connection.js:838:9)

at Object.onceWrapper (node:events:633:26)

at Connection.emit (node:events:518:28)

at Connection.emit (/Users/shaswatadas/Documents/React Project/authentication-app-by-azure/node_modules/tedious/lib/connection.js:959:18)

at /Users/shaswatadas/Documents/React Project/authentication-app-by-azure/node_modules/tedious/lib/connection.js:2487:18

at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {

code: undefined,

originalError: AggregateError

  at /Users/shaswatadas/Documents/React Project/authentication-app-by-azure/node_modules/tedious/lib/connection.js:2486:31

  at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {

[errors]: [ [ConnectionError], [AggregateAuthenticationError] ]  

Can you please help me to figure out the issue?

Azure SQL Database
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,933 questions
{count} votes

Accepted answer
  1. SSingh-MSFT 16,371 Reputation points Moderator
    2024-05-23T05:08:35.3833333+00:00

    Hi SHASWATA DAS •,

    I'm glad that you were able to resolve your issue and thank you for posting your solution so that others experiencing the same thing can easily reference this! Since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others ", I'll repost your solution in case you'd like to "Accept " the answer.

    Solution taken in Customer Verbatim:

    I have made some changes and now I am able to connect with the DB from node.js. and answering your question, I am using the SQL database service.

    The modifications I have made are -

    1. Microsoft Entra authentication only - I have to check the box as false because I am trying to connect via username and password.
    2. Port issue - Previously I am trying to connect via a port which is closed.

    These are some issues that landed me in the issue. But now it is communicating with the DB well.

    If you have any other questions or are still running into more issues, please let me know. Thank you again for your time and patience throughout this issue.

    Please remember to "Accept Answer" if any answer/reply helped, so that others in the community facing similar issues can easily find the solution.

    Thanks

    0 comments No comments

0 additional answers

Sort by: Most helpful

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.