Connect to On Prem SQL server from Azure Web app
Since your on-premise database is in your private on-premise network, Azure service could not find it, you could expose a public IP for the on-premise database or use Azure web app service VNet integration with Azure VPN gateway to securely access the resource in an Azure VNet or on-premise network.
Another recommended method is to use an Azure App Service Hybrid Connections. To do this, you need to add and create Hybrid Connections in your app. You will download and install an agent (the Hybrid Connection Manager) in the database server or another server which is in the same network as the on-premise database.
The main steps are as follows:
- You configure a logical connection on your app service or web app.
- A small agent, the Hybrid Connection Manager, is downloaded and installed on a Windows Server (2012 or later) running in the remote network (on-premises or anywhere) that you need to communicate with.
- You log into your Azure subscription in the Hybrid Connection manager and select the logical connection in your app service.
- The Hybrid Connection Manager will initiate a secure tunnel out (TCP 80/443) to your app service in Azure.
- Your app service can now communicate with TCP-based services, on Windows or Linux, in the remote network via the Hybrid Connection Manager.
You could get more details on how to Connect Azure Web Apps To On-Premises.
Your on-premise SQL server must be hosted on public IP Address to connect from Azure Web APP. Once you will expose your SQL server on public IP, you should also apply firewall rules to ensure that only Azure Web App can access for security perspective.