Hi @Noel Pena
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.
Ask:Need help connecting a Python Flask app to on-prem SQL Server
Solution:
ere is what I was able to do to fix this issue. I thought it was an ODBC driver issue but it wasn't.
I asked my admin to look at the event viewer on the SQL Server to see if there was anything suspicious and he found this error that corresponded with my attempts.
Here's the error:
plaintextCopy
An TLS 1.2 connection request was received from a remote client application, but none of the cipher suites supported by the client application are supported by the server. The SSL connection request has failed.
I created a startup.txt file in the root of my project and added the following:
plaintextCopy
#!/bin/bash
echo "Starting startup script..."
# Install OpenSSL and libssl-dev to support more cipher suites
echo "Installing OpenSSL and libssl-dev..."
apt-get install -y openssl libssl-dev
# Update OpenSSL settings to lower SECLEVEL for ODBC 18
echo "Updating /etc/ssl/openssl.cnf to support SQL Server's cipher suites..."
sed -i 's/SECLEVEL=2/SECLEVEL=1/g' /etc/ssl/openssl.cnf
# Start the application
echo "Starting Gunicorn..."
gunicorn --bind=0.0.0.0 --timeout 300 app:app
These 2 things installing openssl and libssl-dev and updating the security level allowed me my Azure web app to connect with the on-prem SQL Server.
Please don’t forget to Accept Answer
and Yes
for "was this answer helpful" wherever the information provided helps you, this can be beneficial to other community members.