The wait operation timed out establishing a connection to SQL Server FROM Azure Function App

The wait operation timed out establishing a connection to SQL Server FROM Azure Function App



I am building a Function App in Azure and I'm trying to connect to a third party SQL Server. I added in the Application Settings of the function the connection string like this:


Server=[servername],1433;Initial Catalog=[dbname];Persist Security Info=False;
User ID=[myuser];Password=[mypassword];MultipleActiveResultSets=False;
Encrypt=False;TrustServerCertificate=True;Connection Timeout=30;



Of course I replaced the strings on with the real values, but every time I try to connect to the server I get this error:



A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 0 - The wait operation timed out.)



System.ComponentModel.Win32Exception (0x80004005): The wait operation timed out



When I try to connect to the same server, with the same credentials from my local Management Studio it connects correctly, so what am I doing wrong in the connection from Azure?



Thanks for the inputs!




1 Answer
1



Your connection string looks correct. The error would indicate a connectivity issue. If it's working from your local SSMS, I must ask the obvious - is it a SQL database on-premise or a SQL Azure database in Azure? If it's on-premise you won't be able to connect to it from Azure unless you set up a hybrid connection or express route. If it's in Azure, you may have the server name wrong. A SQL Azure database would have a host name that is affixed with *.database.windows.net.





It is a SQL database on-premise (not Azure), how do I set up a hybrid connection or express route? Thanks!
– GGAle
Aug 27 at 14:46





Hybrid connections are probably easier to setup, but require installing a listener on your on-prem server. Here's some documentation: docs.microsoft.com/en-us/azure/app-service/… . Express Route is much more complicated to setup but offers the best performance. In essence it is about joining your on-prem network with a vnet in Azure and you will need to contact your ISP. If performance isn't a major concern, Hybrid Connections might be the quickest way to get up and running.
– Mehdi Ibrahim
Aug 27 at 15:24





p.s. please accept the answer as we have been able to accurately determine the cause of your connectivity issues.
– Mehdi Ibrahim
Aug 27 at 15:29





I'll accept the answer just to help you to get points and to give me a probable cause, but I'm not sure yet if any of those recommendations will actually FIX my problem.
– GGAle
Aug 28 at 16:28





While I think I was able to help you identify the problem, I would have no problems helping you set up a hybrid connection if needed - assuming you weren't able to do so. Feel free to reach out to me on chat or post a new question.
– Mehdi Ibrahim
Aug 28 at 16:30






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Crossroads (UK TV series)

ữḛḳṊẴ ẋ,Ẩṙ,ỹḛẪẠứụỿṞṦ,Ṉẍừ,ứ Ị,Ḵ,ṏ ṇỪḎḰṰọửḊ ṾḨḮữẑỶṑỗḮṣṉẃ Ữẩụ,ṓ,ḹẕḪḫỞṿḭ ỒṱṨẁṋṜ ḅẈ ṉ ứṀḱṑỒḵ,ḏ,ḊḖỹẊ Ẻḷổ,ṥ ẔḲẪụḣể Ṱ ḭỏựẶ Ồ Ṩ,ẂḿṡḾồ ỗṗṡịṞẤḵṽẃ ṸḒẄẘ,ủẞẵṦṟầṓế