0

I have an ASP.NET Core 8 Web API, and it needs to reach an Azure SQL managed instance that exists in other resource group.

I already peered the virtual network of the managed instance with my web app virtual network.

I already created the inbound and outbound security rules on my network security group

inbound rule

outbound rule

On my web app I am using the default dns feature.

There is no firewall configured in the managed instance virtual network. The same in the web app virtual network.

When I debug the web app using visual studio I catch a timeout exception after the managed instance was not found.

If I run my web app from Visual Studio, I can reach the managed instance without problem.

I want to connect my Azure web app to my Azure SQL managed instance.

4
  • Try running a shell in SCM for your app and testing domain name resolution and connectivity from there. For windows app service plans run nslookup <yourManagedInstamceDomainName>. This should produce the instance private IP. And PowerShell Test-NetConnection -TcpPort 1433 -Host <privateIP>. For Linux, dig <sqlDomainName> and nc <privateIP> 1433. Commented Jun 17, 2024 at 21:43
  • @JCano try using these app settings for web app over vnet .check this learn.microsoft.com/en-us/azure/app-service/… Commented Jun 18, 2024 at 5:55
  • Thank you @ArchitectJamie I tried but I was not able to reach the managed instance. Thank you anyway for the suggestion Commented Jun 18, 2024 at 20:11
  • @VivekVaibhavShandilya I added the environment variables that the article suggested and I tried to use the public connection string and It worked! Commented Jun 18, 2024 at 20:14

1 Answer 1

0

After adding the environment variable WEBSITE_VNET_ROUTE_ALL to my webapp as the article https://learn.microsoft.com/en-us/azure/app-service/reference-app-settings?tabs=kudu%2Cdotnet#networking. I was able to reached my managed instance

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.