Azure Web App connecting to SQL FO Group over Private Link - azure

I would like to know few things about my web apps hosted in Central US connecting to Azure SQL FO group connection string. The Primary SQL is hosted in the same region which is Central US and the Secondary Replica is hosted in East US 2.
I am considering using Private Link for Azure SQL.So in order for my web app to talk to the Azure SQL over the private endpoint, i have to enable regional VNET integration for my Web App as i read in MS Docs.
So at the moment i have two subnets in Central US and one of the subnets i have to dedicate for creating VNET integration for my Web Apps. The other subnet will be hosting my SQL Private Endpoint.
I have already enabled Global VNET peering between Primary Central US and the Secondary VNET in East US 2.
So i would like to know whether during a disaster and after a failover happens for my SQL from Primary Central US to secondary East US 2, will my Web Apps automatically connect to the SQL FO group read/write listener after i enable private link for my Azure SQL.
I don't understand what it means by this below as per the link :
https://learn.microsoft.com/en-us/azure/architecture/example-scenario/private-web-app/private-web-app
Global peering
Any service in any Azure region that can connect through the Virtual Network can reach the database's private endpoint, for example through Virtual Network peering in hub-and-spoke topologies. However, for App Service regional VNet Integration, the peered Virtual Networks must be located in the same Azure region.
As per the line "However, for App Service regional VNet Integration, the peered Virtual Networks must be located in the same Azure region.", my peered virtual network is from Central US to East US 2 which is like Global Peering.
So how this statement applies to in my case.
Looking forward to some pointers

Related

Accessing Azure Storage Account using private endpoints and Vnet Integration from an Azure Function (app )

Ok this is to save someone else 4 days of work.
Trying to use VNet integration to connect an Azure Function in the North Central US region to a storage account in the US West region. The storage account in the US West region has the firewall enabled. The only reason I am posting this is our staff normally sets this up for virtual machines which have an IP address that can be added into the storage account firewall and not app service plans.
If you want to secure your azure storage behind a private endpoint and you want a service plan (I.E. Azure Function or Web App) to access said storage account.
When the storage account firewall is disabled.
An App service in the same Vnet containing the storage account endpoints (within a subnet for the app service) works. So to further clarify. You would have a Vnet with the default subnet, a storage subnet, and a app subnet. The storage account firewall is off. Then the web app can access the endpoints that you setup in the storage subnet.
When the storage account firewall is enabled.
If you intend to use Vnet peering (very easy). The VNets need to be in the same region (I.E. US East) or within a region pair like (US East/US West)
You must setup Vnet peering.
You must add the subnet used by the app service into the storage account firewall.
Also a subnet that is not within the same region or a region pair will not show up in the storage account firewall for you to add it.
There is the option to try a preview feature AllowGlobaltagsForStorage but I cannot use that within a production environment.
So to clarify this:
You have Vnet useastvnet with subnets default, storage
Your storage account has private endpoints into the storage subnet
The storage account firewall is enabled.
You have another Vnet uswestvnet with subnets
default, apps
You have useastvnet peered with uswestvnet
You have the subnet apps added into the storage account firewall.
You have your web app or Azure Function using vnet integration into the app subnet
With this setup you can simply use the storage account connect string and everything should work as long as you have the endpoints setup that you need.
So my fix was to move my setup to the US West region.

Configure and verify Vnet in Azure

I have created a Virtual Network next to its subnet and integrated it into three service applications and created the rule on the firewall of my SQL Azure server.
Everything is in the same Azure subscription and region
I need to know if it is enough to direct all the traffic between these instances through the virtual network or do I need to configure some other aspect.
And how can I query the data traffic to verify that the virtual network is being used?
Azure Virtual Network (VNets) allows to place Azure resources in a non-internet-routable network.
https://learn.microsoft.com/en-us/azure/architecture/example-scenario/private-web-app/private-web-app#architecture
Using Azure App Service regional VNet Integration, the web app connects to Azure through an AppSvcSubnet delegated subnet in an Azure Virtual Network.
Virtual Network only routes traffic and is otherwise empty, but other subnets and workloads could also run in the Virtual Network.
The App Service and Private Link subnets could be in separate peered Virtual Networks, for example as part of a hub-and-spoke network configuration. For regional VNet Integration, the peered Virtual Networks must be located in the same Azure region.
Azure Private Link sets up a private endpoint for the Azure SQL database in the PrivateLinkSubnet of the Virtual Network.
The web app connects to the SQL Database private endpoint through the PrivateLinkSubnet of the Virtual Network.
The database firewall allows only traffic coming from the PrivateLinkSubnet to connect, making the database inaccessible from the public internet.

How can I make Azure function in one region communicate with Virtual Machine sitting on other region?

I have resources spread across multiple regions (Central US and Europe) in Azure environment.
Function 1 - Central US
Function 2 - Europe
Virtual Network and Virtual Machine - Europe
I am able to connect function 2 and virtual machine using feature called VNET integration as mentioned in https://learn.microsoft.com/en-us/azure/azure-functions/functions-create-vnet
But, I am not able to connect function1 to virtual machine because these are cross region connection.
How can I solve this issue? Do I need to add VNET in central US, then do VNET Peering?
Even though VNET-VNET (Virtual Network Gateway) connection established. I am using the premium azure function.
Unable to find the VNET belongs to another region in the dropdown :(
Solution Found
In order for function app to communicate with Virtual machine privately, function app needs to be integrated with VNET to be able to reach VM.
The function app running on Elastic premium plan that only gives a single option of VNET integration which is Regional VNET integration: https://learn.microsoft.com/en-us/azure/azure-functions/functions-networking-options#matrix-of-networking-features
Function should be into App Service Plan (Dedicated Plan). Function app is having full access to Point-to-Site VPN connection and Regional VNET integration. I was using Consumption plan and which is also one of the issues.

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 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