1

Is it possible to connect an Azure Web App to a SQL Managed Instance via the private endpoint for the MI?

Following the documentation here https://learn.microsoft.com/en-us/azure/sql-database/sql-database-managed-instance-connect-app it seems to be that as long as the web app service is in the same VNET as the managed instance, then the connection should be OK via the private endpoint.

I have enabled VNET integration on the app service so that it is integrated into the same VNET as the managed instance. I have also whitelisted all of the outbound IP addresses for the webapp (including the additional ones) on port 1433 for the MI.

Using the private connection string for the MI, the webapp fails to connect when loading the front end and also when checking the connection string via the diagnostic tools.

Enabling the public endpoint on the MI and whitelisting all outbound IPs on port 3342, the webapp is able to connect straight away with no issues. Switching back to the private endpoint fails again.

The error message received is:

System.Data.SqlClient.SqlException: 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)
  • 2
    In case any else has the issue, the solution was to sync the app service network following the VNET integration - docs here https://learn.microsoft.com/en-us/azure/sql-database/sql-database-managed-instance-sync-network-configuration – ThomasTheDankEngine Jun 24 '19 at 10:17

1 Answers1

0

Came across this issue as well, a simple restart after the vnet-integration activated the connection for me