Help Deploy APP - Connect Azure SQL Firewall IP

Hello,
I am facing an issue with deploying my app.
I’ve been researching for a few days on how to get Streamlit to communicate with my database to generate my dataframe.
The problem is that my database on Azure has firewall IP rules, which block Streamlit from executing the query.
Can someone help me, please?

What IP rules? You probably need to change that.

Hello Friend!

To access the database, I need to whitelist the IP to be able to perform the query.
I think this is a default security measure for most cloud databases.
If I were to change it, which security method would replace the IP firewall?

Then whitelist the IP of the server running the application. Note that you cannot reliably do that if you host the application in streamlit cloud, because the IP can change at any moment.

What solution do you propose?
I need to run Streamlit on an Azure virtual machine?
How do people solve this problem?
I see that this must be a very common issue, considering that almost all databases have this firewall rule requiring the IP to be cleared for access.

What’s the best solution to resolve this?
If it’s possible to run Streamlit on an Azure virtual machine, that would be viable for me. Because if it’s mandatory to be an Azure Web App Service, that would incur an additional cost.

It depends on your needs.

  • You can deploy the app to some other infrastructure (perhaps your own) where it can get a stable IP address.

  • You can relax your security requirements and allow connections from unknown IP addresses.

  • You can whitelist the current IP address of the application and hope that it will last for some time. Then change the white list when the IP changes and the thing breaks.

It should be able to run in any machine as long as you can install it and it is reachable from the Internet. I am not familiar with Azure virtual machines or any limitations they can have attached.

Well, I don’t know. Maybe it is a fact of life that stable public IP addreses cost money.

If I deploy using Streamlit community, how do I get access to the IP and release it on my database?
I think this solution would help me until I can finish the process of running it on my virtual machine.

I don’t know, but it can certainly be done. Can your DB log attemps to connect from non-whitelisted addresses?

Great idea! I’ll check that out and get back here if I was successful.
Thank you so much for the support, my friend.

I think Streamlit doesn’t support ODBC;
I’ve been trying to deploy this for days.
I don’t know what to do anymore…

Error: (‘01000’, “[01000] [unixODBC][Driver Manager]Can’t open lib ‘ODBC Driver 18 for SQL Server’ : file not found (0) (SQLDriverConnect)”)

2024-05-21 05:07:37.370 503 GET /script-health-check (10.12.80.122) 191.70ms"

I finally managed to deploy.
I adjusted the query for ODBC 17.
I added msodbcsql17 to the packages and allowed the IP in my database.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.