Can't connect to new Azure SQL Server instance - azure

I've just spun up an instance Azure SQL server. I can connect to it from the Azure Portal, but I get a timeout error when trying to connect with SQL Management Studio (and other methods):
Cannot connect to *server*,*port*.
Additional information:
A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: TCP Provider, error: 0 - The semaphore timeout period has expired.)
(Microsoft SQL Server, Error: 121)
The semaphore timeout period has expired
I've been searching for a solution but the only thing I find about the error message is that the database is under heavy load, which seems unlikely concidering it was just created!
Anybody know what can cause this problem?
Thanks!

Error 121 has always been considered a network related error as you can read in this Microsoft Support article. The Internet service you receive, network adapters are things you should consider examine.
Please consider to click the "Options" button of SQL Server Management Studio, on the "Connection Properties" tab, try setting a greater value for the "Connection time-out" setting.
If you need to use a Corporate VPN to connect to Azure SQL Database, make sure you are connected to the VPN.

Problem is related to a Firewall in the middle doing SSL inspection.
I Suggest to try requesting your firewall admin to add an exemption on the SSL Inspection engine , or try using another connection not doing SSL inspection.

So it seems it was the company firewall that was blocking the traffic. I tried from another network entirely and then I could access the server.
I guess my two alternatives now are either to unblock 1433 in the company firewall, or to open another port in Azure SQL Server, which doesn't seem possible at the moment.

Related

Azure Function VNet integration breaks randomly

I'm using Azure Functions with .NET 6 on an S1-tier App Service Plan with regional VNET integration. In our scenario, we execute some SQL queries accessing an On-Prem database which works pretty fine at the first glance. Unfortunately, sometimes the virtual network connection seems to break and our queries run into following 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 - An attempt was made to access a socket in a way forbidden by its access permissions.) An attempt was made to access a socket in a way forbidden by its access permissions.
After disconnecting and reconnecting the function from VNET, it starts working again as expected (I found this approach here)
But it seems like this is just a really poor workaround. Does anybody know how to fix this indefinitely? I've already tried creating a new function app but that didn't change anything.
• According to the error that you are encountering, there might be some issues with the Firewall in the on-premises environment or the TCP/IP connection being established. Thus, I would suggest you to please check all the issues mentioned in the documentation link below and verify whether all the instances of practices mentioned in it are followed correctly: -
https://learn.microsoft.com/en-us/troubleshoot/sql/connect/network-related-or-instance-specific-error-occurred-while-establishing-connection
• Secondly, I would suggest you to please check the SQL Browser Service in the on-premises SQL Database server and check whether ‘UDP port 1434’ is whitelisted for communication between the two environments or not along with TCP 1434. Also, when executing SQL queries to access the on-premises SQL DB, ensure that the instance name is input correctly along with the port number. Also, when mentioning the port number, ensure that it is preceded by ‘,’ and not ‘:’.
• Finally, I would suggest you enable diagnostic logging for an app service plan by referring to the below documentation link that will help you figure out the reason for your connection error to the SQL DB. Also, you can browse through the Kudu console by accessing the url:- https://****.scm.azurewebsites.net/ (enter your website name instead of ****). You should be able to find the log files under the debug console. Please check if there are any failure logs: -
https://learn.microsoft.com/en-us/azure/app-service/troubleshoot-diagnostic-logs#:~:text=To%20enable%20application%20logging%20for,itself%20off%20in%2012%20hours.
https://github.com/projectkudu/kudu/wiki/Investigating-issues
Note: - Please check whether your API URL connection string used in the function app is being replaced correctly and troubleshoot your connection variables thoroughly.

Why does my Azure Hybrid Connection show a "Status Unknown"?

So...about 5pm 2 nights ago, all 14 of my listeners on my Azure Service Bus dropped. So I logged in to my on-prem SQL Server to check on my Hybrid Connections and both of them showed a status of "Status Unknown". I can't find anything on the internet about this specific status.
Nothing changed on my SQL Server other than the fact that I've pegged the RAM....it's at 100% usage.
If I go to the Azure Portal, navigate to either of my Hybrid Connection Overview pages and click on the "Hybrid Connection Url", I get the following message in the browser:
"error": {
"code":"TokenMissingOrInvalid",
"message":"MissingToken: Relay security token is required. TrackingId:*SOME GUID*, SystemTracker:*SERVICE BUS NAME*:*HYBRID CONNECTION NAME*, Timestamp:2021-08-04T04:19:16"}
}
Now....I didn't change anything on my Hybrid Connection configurations. I haven't changed anything about tokens. I have no idea what's going on other than my Azure App Services have been down for 2 days, now.
Any help would be greatly appreciated....
This looks like an authentication error where a token might not be generating when you are trying to make a call to the underlying On prem server
You can refer the SO thread for ServiceBusAuthorization and still if you are facing the issue kindly raise a ticket with MS-Q&A
Microsoft support led me to this article where I found the following information:
Make Sure that the Date and Time are Correct
The Hybrid Connection Manager connects to Azure Relay using Secure Sockets Layer (SSL) on port 443. If there's a problem with your SSL handshake or connection, it will break your Hybrid Connection. If you find that your Hybrid Connection works initially, and then it stops working after about 10 minutes, that's a sign that you need to check the date and time on the machine running the Hybrid Connection Manager. Make sure they are correct because if they're not, your SSL connection may not work.
Well...the time on my server was off by about 16 minutes b/c of a group policy that I had never bothered to fix b/c I don't know anything about group policies. So I looked up how to fix the server's clock and, once that done, resolved this issue.

Getting an intermittent error while connecting to on-premise sql database from Azure service

Created an azure MVC website, from service (controller) code we are connecting to an on-premise sql server using Azure Hybrid Connection. Intermittently we are facing below issue.
"A transport-level error has occurred when receiving results from the
server. (provider: TCP Provider, error: 0 - The specified network name
is no longer available.)"
Please provide suggestions to resolve this issue.
You can try following solutions :
Try increasing connection time-out.
check if remote connection is enabled.
Try adding firewall exception.
First of all the error means either the networks has some extra latency, the database is down or you may have too many concurrent connections open the database.
(Make sure you are closing all open datareaders.)
also it may be due to this
These are transient faults and are to be expected in the cloud. Implementing defensive programming is usually a must in the cloud. Try using some retry logic. Microsoft's transient fault exception library is an excellent start. Though meant primarily for SQL Azure and Azure Service bus, you can use the library for SQL IaaS.
In my opinion, 98% sure, because I recently had the same experience, it is a network issue from the server provider.
For instance: if you are rent the server from Ionos, by default all remote connections are blocked, even though you disable the firewall in the server. You still won't be able to connect remotely. You can, however, do your work on the server without any problem.
To connect remotely, you have to contact the server provider. They will explain how to enable firewall ports from your control panel.
I contacted my server provider as I almost get frustrated. Here was their response.
enter image description here
After this, every permitted client can connect remotely to the server.
I wish you success.

Connecting Apps with Windows Azure Connect - Problem connecting

I'm following the Connecting Apps with Windows Azure Connect lab in the Azure Training Kit.
I've followed the instructions to set up the Groups and Roles, and the Activated EndPoints.
I've updated the SQL Express settings and restarted the service
I've installed the local endpoint, which gives the following text.
I've added a new Windows Firewall rule
This endpoint is configured to
connect, and can connect to other
resources in Windows Azure Connect.
I still get this error displayed in the browser.
Sorry, an error occurred while
processing your request.
Message: The underlying provider
failed on Open. Inner Message: 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 - No such host is known.)
Any ideas on why this might be or suggestions on finding out where it is failing?
Thanks.
Update
I found this link "Windows Azure Connect and Symantec Endpoint Protection" describing a similar problem; as the title suggests Symantec EndPoint Protection could be the problem.
Although in this case, removing Symantec did not fix the problem
Update 2
some messages from Event Viewer - this set is repeated every 2 mins, they dont appear connected to a web page request.
at 9:29:40 [Information]
The user SYSTEM has successfully
established a link to the Remote
Access Server using the following
device: Server address/Phone Number =
sydrelay4.windows.azure-test.net
also at 9:29:40 [Information]
The link to the Remote Access Server
has been established by user SYSTEM.
at 9:29:41 [Error]
The user SYSTEM dialed a connection
named Windows Azure Connect Relay2 1
which has failed. The error code
returned on failure is 798.
at 9:29:45 [Information]
The user SYSTEM dialed a connection
named Windows Azure Connect Relay2 1
which has terminated. The reason code
returned on termination is 631
I had the exact same issue, Symantec et al. I was able to resolve it by adding the .cer certs I used in the Azure portal for the Hosted Services -> Management Certificates to my personal certificates collection via MMC and then rebooting my computer.
Hope that helps.
If you’re receiving a message like that, it’s possible that your current location has an outgoing port blocked.
Check this thread:
SQL Azure : Connection to SQL Azure throws exception
Is your machine behind a proxy? If so try to run the following commands to set proxy for the local system account:
bitsadmin /UTIL /SETIEPROXY LOCALSYSTEM NO_PROXY
bitsadmin /UTIL /SETIEPROXY LOCALSYSTEM MANUAL_PROXY a.b.c.d:80 NULL

Sharepoint application not working!

I am facing a weird problem and no body seems to have a solution for it.
The thing is that i am working on a Sharepoint application. It was working fine until our organization underwent a network maintenance.
The next day i try to run my application and kaboom!! it throws me an 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: Named Pipes
Provider, error: 40 - Could not open a
connection to SQL Server)
I later found out that during the maintenance the IP of my machine has changed.
It is possible that the change of an IP could result in my sharepoint application not working!!
I did my research and found that nothing has been changed in my application and that the SQL server (which is on my machine itself) is working fine! And still my application is DEAD!!
Please help, any suggestions will be helpful!
thank you.
DON'T PANIC!
The error message is pretty clear and it's not related to Sharepoint. Your web application can no longer connect to the database.
Perhaps you have configured Windows Firewall (or another firewall) to allow connections to the database using your old IP. Maybe you haven't enabled Named Pipes or you have hard-coded the old IP address in your hosts file. Or maybe your web application's account can no longer connect to the database. Changing a server's IP is no small change so maybe someone did a few more modifications as well.
If you can connect to your Central Administration site the problem is probably related to the Web Application's account. If you can't connect to Central Admin, the problem is related to the database connection.
To check the connection try to connect to the database using the exact same credentials (Provider Name, account, password etc.). You can do this either by using the Options tab of the SQL Server Management Studio connection dialog, or by writing a small program yourself to test the connection to the database.

Resources