9

I'm trying to figure out a way to connect my web app running in Azure AppServices to an Azure Virtual Machine that's hosting a database server.

I can see that the Azure VM has both a public and private IP. I'm trying to get the AppService instance to connect to the Azure VM through its private IP. I've googled and read through the docs but I can't seem to figure out if this is even possible to do.

So I guess my question is this, is it possible to somehow configure private IPs for AppService instances in order to pull this off?

PS: There's an additional use-case where I would need for two AppService instances to talk to each other through private IPs as well. Are either cases possible?

enriquein
  • 252
  • 1
  • 3
  • 10

2 Answers2

7

To allow your App Service to access your VM over it's private IP you need to enable Virtual Network (VNET) integration. This will allow your app to communicate directly with your DB over the private VNET. Fulls steps on how to set this up are here.

A few things to bear in mind:

  • This requires a standard or premium web app
  • Your VNET must have point-to-site VPN enabled with a Dynamic routing gateway, you may have to recreate your VNET to enable this.
  • The VNET and App Service must be in the same subscription
Sam Cogan
  • 38,736
  • 6
  • 78
  • 114
-2

You could give a try to the way when you put your resources into the one Virtual Network. VN is the service that provides a way to create the network where you will have a continuous IP space which looks like your scenario. For Web App, you need to create an App Service Environment and put your web app there. Tutorial. Or you may put your Web App into the existing VN.

I think that without that you will not be able to implement what you want (taking into the account the fact that Web App is quite isolated from the user interaction with such settings like network, etc).