How can we access SQL Server hosted on on-premises from Function app

Ritika Pandey 25 Reputation points
2024-05-14T09:32:05.17+00:00

I am trying to access SQL Server hosted on Azure VM from Function app using python. But I am getting this error: Result: Failure Exception: OperationalError: (pyodbc.OperationalError) ('HYT00', '[HYT00] [Microsoft][ODBC Driver 18 for SQL Server]Login timeout expired (0) (SQLDriverConnect)')

I also created hybrid connection manager to build the connection between SQL Server and function app. but it didn't work.

So Could you please assist me with this?

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,188 questions
{count} votes

Accepted answer
  1. LeelaRajeshSayana-MSFT 16,611 Reputation points
    2024-05-15T00:48:12.5633333+00:00

    Hi @Ritika Pandey Greetings! Welcome to Microsoft Q&A forum. Thank you for posting this question here.

    Have you tried pinging the SQL Server from outside your VM? It could be possible that port on which your SQL server is hosted is not configured to accept external connections. Please take a look into the firewall configurations of your Azure VM and configure the port to allow inbound connections.

    Let me know if this helps.


1 additional answer

Sort by: Most helpful
  1. LiHongMSFT-4306 29,111 Reputation points
    2024-05-15T02:11:49.4233333+00:00

    Hi @Ritika Pandey

    Not an expert on Azure Functions app, but from SQL Server side, please check the SQL Server Configuration Manager and make sure that the SQL Server is configured to allow remote connections.

    Also, ensure that TCP/IP protocol is enabled for SQL Server.

    Best regards,

    Cosmog Hong


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    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.