How to integrate Azure Web App with a VNet with gateway transit - azure

I have two VNets: A and B.
VNet B has a VPN gateway and connected to an on-premise network. VNet A is peered with VNet B with transit gateway enabled. This works perfectly for virtual machines. I deploy VMs to VNet A and can access on-premise resources from there VMs.
Now I want to deploy a Web App and connect it to VNet A, so the web app will have access to on-premise resources. But to do so, I need to add a VPN gateway into the network A, which is impossible when the network is peered with another network with Use remote gateway option on. But I need this option to be on to have access to on-premise resources.
What should I do? How I can give access from Web App to on-premise resources without using App Service Environment? Is it possible?
Basically, I need the combination of these two schemes

In this case, you should integrate with VNet B from the Azure web app. Also, It will be integrated with a point-to-site VPN enabled VNet. There is a new version of the VNet Integration feature that is in preview. It doesn't depend on point-to-site VPN. From your scenario, the web app is working like " VPN clients" in a P2S connection on the second picture.
Here are some things to keep in mind before connecting your web app to a virtual network:
A target virtual network must have point-to-site VPN enabled with a
route-based gateway before it can be connected to app. The VNet must
be in the same subscription as your App Service Plan(ASP). The apps
that integrate with a VNet use the DNS that is specified for that
VNet.
Ref: https://learn.microsoft.com/en-us/azure/app-service/web-sites-integrate-with-vnet

Related

Can Azure App Services have fixed MAC addresses?

I've got an Azure app service that I'd like to use to run some software that requires licensing. The license is provided via a server on our internal network. The issue being finding a way to connect to this server.
The first option is to provide a fixed license that ties to the MAC address. However I don't think this will be possible from an app service, as it does not really have a MAC address? Can I provide a VNI to it and obtain a fixed MAC address that way?
What other options are there? Can the app service be tied to a VNET that can tunnel to the on-premises resource? Should I use a VM with a VNI instead of an app service? Any resources on these kind of problems would be appreciated.
I have used Azure Relay to connect my on-prem service with my app service. Not sure if you have already considered this option.
If your requirement is to establish a connection between your on-prem service and you app service, check out this https://learn.microsoft.com/en-us/azure/service-bus-relay/relay-what-is-it
Hope this helps
You could use VNet Integration with Azure App service and Azure VPN gateway to connect to on-premise resources. VNet Integration is used only to make outbound calls from your app into your VNet. There are Regional VNet Integration and Gateway-required VNet Integration.
How regional VNet Integration works
Regional VNet Integration works by mounting virtual interfaces with
addresses in the delegated subnet. Because the from address is in your
VNet, it can access most things in or through your VNet like a VM in
your VNet would. The networking implementation is different than
running a VM in your VNet. That's why some networking features aren't
yet available for this feature.
How gateway-required VNet Integration works
Gateway-required VNet Integration is built on top of point-to-site VPN
technology. Point-to-site VPNs limit network access to the virtual
machine that hosts the app. Apps are restricted to send traffic out to
the internet only through Hybrid Connections or through VNet
Integration. When your app is configured with the portal to use
gateway-required VNet Integration, a complex negotiation is managed on
your behalf to create and assign certificates on the gateway and the
application side. The result is that the workers used to host your
apps are able to directly connect to the virtual network gateway in
the selected VNet.
For more information, you could read this blog---How to Connect Azure Web Apps To On-Premises
In addition, If you need more control of the application deployment and less scale out or in than the Azure app service. You could host your application on the Azure VM, then set up a VPN gateway in that VNet where Azure VM locate, it allows access to the on-premise resources from your Azure VM as usual in the internal network.

How to add user route to Azure App Services

I have an Azure VM with inside custom vpn to 172.254.254.0/24 route.
I am able to reach that VM from another azure VM adding an "user route" to a "route table" in that VM. It works perfectly.
Now I have an Azure App Services web application.
I need to add the route above too.
But I am stuck I am not able to do it.
Integrate your app with an Azure Virtual Network
The VNet Integration feature has two variations.
Regional VNet Integration - When connecting to Resource Manager VNets in the same region, you must have a dedicated subnet in the VNet you are integrating with.
Gateway required VNet Integration - When connecting to VNets in other regions or to a Classic VNet in the same region you need a Virtual Network gateway provisioned in the target VNet.
Gateway required VNet Integration only provides access to resources in the target VNet or in networks connected to the target VNet with peering or VPNs. Gateway required VNet Integration doesn't enable access to resources available across ExpressRoute connections or works with service endpoints.
Refer: https://learn.microsoft.com/en-us/azure/app-service/web-sites-integrate-with-vnet#enable-vnet-integration

How can I connect an azure app service plan to a vnet which is also connected through peering to another vnet

I am trying to seup this hub-spoke toplogy where I have a hub vnet connected to an expressroute circuit https://learn.microsoft.com/en-us/azure/architecture/reference-architectures/hybrid-networking/hub-spoke
I have another VNET (lets call it the app vnet) set up with peering to this hub VNET where I can create a virtual machine and ping resources on the other end of just fine using the remote gateway setting on the peering.
The problem is by using remote gateway, my app vnet cannot have its own gateway, and so I cannot integrate an app service plan with the vnet.
Is there another way I could accomplish this?
I would like to suggest setting up a VNet-to-VNet VPN gateway connection instead of Vnet peering between hub vNet and app vNet. If so, Each of vNet will have their own gateway. The App vNet will be integrated with your web app. You need to ensure that the address prefixes don’t overlap among all the connected networks.
Update
Perhaps you can use the new preview VNet Integration.
There is a new version of the VNet Integration capability that doesn't
depend on Point-to-Site VPN technology. Unlike the pre-existing
feature, the new Preview feature will work with ExpressRoute and
Service Endpoints.
The new version is in Preview and has the following characteristics.
No gateway is required to use the new VNet Integration feature You can
access resources across ExpressRoute connections without any
additional configuration beyond integrating with the ExpressRoute
connected VNet. The app and the VNet must be in the same region
...
Ref: https://learn.microsoft.com/en-us/azure/app-service/web-sites-integrate-with-vnet#new-vnet-integration
The limitation that you are encountering is from the Vnet gateway perspective. Using remote gateway over peering handicaps one from deploying the Gateway in that Vnet.
The alternative as suggested by #nancy should do the trick. But, you will have to incur the cost of having the gateway. Secondly, this will require a co-existence set-up.
That is you will have to deploy another VPN gateway:
Change of reference:
VNET-HUB (Your hub VNET with ExR)
VNET-SPOKE1 (Current peered as referred to as your Application VNet)
Your VNET-HUB has an ExR gateway, it needs to have another VPN gateway.
Your VNET-SPOKE1 needs to have a VPN gateway deployed as well.
Allowing for the VNET-HUB to talk to the App Service Environment that you would integrate via point-to-site.
Note: The On-premise will not be able to access the App VNet as we can't have a Point-to-site co-exist with Express Route.
I hope this has provided an insight into the limitations.
References/good reads:
https://learn.microsoft.com/en-us/azure/expressroute/expressroute-routing
https://learn.microsoft.com/en-us/azure/expressroute/expressroute-howto-coexist-classic
https://learn.microsoft.com/en-us/azure/expressroute/expressroute-faqs
https://learn.microsoft.com/en-us/azure/app-service/environment/app-service-app-service-environment-network-configuration-expressroute

Cannot integrate Azure Web App to Vnet

I have Web App and SQL Server VM on Vnet running on Azure.  I would like to integrate Web App to virtual network.
I'm followings https://learn.microsoft.com/en-us/azure/app-service-web/web-sites-integrate-with-vnet#managing-the-vnet-integrations
1) I created gateway subnet and gateway.
2) I opened "App Service->Networking->VNet integration->Setup->Virtual network is visible but it is gray!
What I need to do that I can connect Web App to Vnet?
There are multiple reasons that a VNet can be grayed out including:
• the VNet is in another subscription that your account has access to
• the VNet does not have Point to Site enabled
• the VNet does not have a dynamic routing gateway
According to your steps, This issue may caused by that you might not configure a P2S address pool of your VPN gateway .
I did a test in my lab, and finally I can integrate my Web App to the Vnet.
You should to check these two point as following images:
Your VPN ponit-to-site configuration:
Your VNet connected devices:
How to Enabling Point to Site in a Resource Manager VNet:
To configure a Resource Manager VNet with a gateway and Point to Site, you can use either PowerShell as documented here, Configure a Point-to-Site connection to a virtual network using PowerShell or use the Azure portal as documented here, Configure a Point-to-Site connection to a VNet using the Azure portal. The UI to perform this capability is not yet available. Note that you need to create certificates for the Point to Site configuration. This is automatically configured when you connect your WebApp to the VNet.

How to Connect Azure Web App/ API App to Classic portals networks?

I have a Azure Web app and API App which are accessing some services from network which is connected to Client's network via old (classic) portal.This networks is already connected to client and Created in Classic portal.
While Creating Web/API App in new portal i am not able to connect to this existing network. Is there any way i can connect these apps to classic portals network?
Is there any way i can connect these apps to classic portals network?
Yes, but VNet Integration only works with apps in a Standard, Premium, or Isolated pricing plan. If your WebApp service plan is not in the Standard+ service plan, please have try to scale your App Service Plan to support it. We could get the details steps about how to enable VNet Integration from the Azure official document. The following is the snippet from the document.
Note:
If your target virtual network already exists, it must have point-to-site VPN enabled with a Dynamic routing gateway before it can be connected to an app. If your gateway is configured with Static routing, you cannot enable point-to-site Virtual Private Network (VPN).
The VNet must be in the same subscription as your App Service Plan(ASP).
The apps that integrate with a VNet use the DNS that is specified for that VNet.
By default your integrating apps only route traffic into your VNet based on the routes that are defined in your VNet.
Enabling VNet Integration with a pre-existing VNet
The VNet Integration UI allows you to select from a list of your VNets. The Classic VNets indicate that they are such with the word "Classic" in parentheses next to the VNet name. The list is sorted such that the Resource Manager VNets are listed first. In the image shown below you can see that only one VNet can be selected. There are multiple reasons that a VNet can be grayed out including:
the VNet is in another subscription that your account has access to
the VNet does not have Point to Site enabled
the VNet does not have a
dynamic routing gateway
Related link:
Create a virtual network (classic) by using the Azure portal
Connect virtual networks from different deployment models using the portal

Resources