Azure - Application Gateway without public IP - azure

I'm trying to deploy my application on Azure. Currently, I have an application gateway deployed in one subnet s1, and in the backend pool I have Linux VMs. As per the requirement, I cannot use any public ip so, I'm using only private ip on Application Gateway. Since we need the internet connection at the time of deploying application, I tried attaching NSG to the Application Gateway's subnet with inbound "Internet" allowed. When I attached the NSG to application gateway subnet, the backend health showed as unhealthy with error:
"Cannot connect to server. Check whether any NSG/UDR/Firewall is blocking access to server. Check if application is running on correct port."
I tried to add rules specified in MSFT's document https://learn.microsoft.com/en-us/azure/application-gateway/configuration-overview#allow-application-gateway-access-to-a-few-source-ips but its not helpful. So my questions are:
Is there anything more I need to add to NSG on application gateway's subnet.
Is it a good strategy to allow internet access using the inbound rule on NSG? (Inbound rule -> service tag -> Internet). Is there any other way I can have internet access just at the time of deployment? PS: I'm not allowed to use public IP at all.
Many thanks!

You can deploy Application Gateway with Public IP and Private IP. All you need to do is to create the listener with the private Frontend IP and leave the Public IP as such.
Since Public IP is not attached with any of the listener, no one will be able to access your site from Internet via Public IP of your Application Gateway.
When AppGW needs to initiate outbound to Internet, it uses that Public IP.
Note: You cannot have only Private IP as Frontend in V2 deployment and you can deploy Application Gateway with only Private Frontend IP in V1 SKU.

Related

Azure App service not accessible with private endpoint within APIM/VM

I have configured my app serivce to be part of a subnet within a VNET.
Now i have integrated my app service with a private endpoint within the same VNET.
With the private endpoint integration, i'm now not able to access the app service (i.e. my API) on a public internet, where i'm getting 403 forbidden error. Which is an expected behaviour to restrict the access on the public network
But the issue is, i want to expose this API via APIM (which is internal) configured within a separate subnet in the same VNET, but i'm not not access the API now with the private endpoint IP address. I was hoping that the resources with in the VNET will be able to reach the App service using its private IP address
I also tried to configure a VM in a separate subnet with in the same VNET, but when i ping the API private IP from the VM, i'm getting request timedout.
Current there have not been any rules setup with NSG to restrict the subnets to talk between each other.
Please let me know how to expose the API with private endpoint via APIM which is also configured to be only internal
You also need to configure private dns zone as now your app's FQDN needs to be resolved to the private IP, instead of a public one.
https://learn.microsoft.com/en-us/azure/private-link/create-private-endpoint-powershell
Update:
Just want to add that app service cannot be accessed via the IP as it is assigned to the app service plan, which can be shared by other app services. The FQDN is required for app service plan to do L7 routing

Azure Container Group behind application gateway with public IP

I have an application gateway with frontend public IP address, connected to a VNET via its subnet and using a single backend pool that points to a container group in the same VNET but different subnet.
The backend pool points to the IP address of the container group. That works!
But I don't want to rely on an IP address that could change anytime with the container restart. I already use a private DNS zone linked to the VNET. The container group is accessible as "mycontainer.my-azure.com" from the VNET thanks to the A record in my private DNS zone.
But putting "mycontainer.my-azure.com" as the FQDN of the backend pool does not work. It works with the IP address "172.22.44.5" but "mycontainer.my-azure.com" does not resolve, backend health shows "Unknown". I tried restarting the APP GW from AZ CLI to no avail.
Does anyone know how to make APP GW use the VNET's private DNS zone in its backend pool?
If the application gateway backend pool contains an internally resolvable FQDN or a private IP address, the application gateway routes the request to the backend server by using its instance private IP addresses. Make sure the FQDN in the backend pool can be resolved internally.
You can verify the following configuration, it works on my side. I am using the Standard V2 SKU application gateway. The application gateway and container group were deployed into the same VNet but different subnets with no firewall rules. I use this example for deploying ACI.
Backend pool
HTTP setting
Listener
Health probe
Private DNS zone

Understanding Test-AzureRmPrivateIPAddressAvailability . Application gateway Private IPs are listed as available

I'm working on a script to figure out which IPs are available for an Application Gateway if there are already Gateways in the subnet.
When I use Test-AzureRmPrivateIPAddressAvailability and test an IP address that's being used by the frontend of an Application Gateway, it still outputs Available. Should it be unavailable?
Not sure, but it seems that is a bug. The private IPs can associate to VM, Load Balancer and Application Gateway. And there should no difference that the availability shows. You can get more details about the Private IP Addresses.
I did the test that when a private IP address associated with the VM and Load Balancer, then the availability of the IP shows False. Except for the Application Gateway.
But don't worry, it does not affect the function of the Application Gateway and the virtual network. When a private IP associated with the Application Gateway and then Azure will disallow other Application Gateways use it( when the Application Gateway create in a subnet and then the subnet can only contains Application Gateway, see this ). Maybe this issue would be fixed in the future.
Hope this will help you.

App Service IP Restriction for Application Gateway with WAF

App Service IP Restriction for Application Gateway with WAF
I want to setup Application Gateway WAF in front of multi-tenant (non-ASE) App Service Web Apps.
I know this is possible now, according to official document.
For security, inbound traffic to Web Apps should be restricted to only allow requests for connection the application gateway Public IP. But I couldn't find the way to do it.
Idea 1. Using VNet integration:
It's not possible to using "App Service Vnet Integration" cause it's not possible to specify App gateway's VNet.
Moreover, in my understanding, VNet integration can't restrict inbound traffic.
Idea 2. Using IP Restriction config of App Service:
Application Gateway's Public IP Address can be configured as Dynamic one, Static IP Address can't be chosen.
So, I think it's not possible to specify Application Gateway's Public IP Address to IP Restriction config of App Service, cause configured IP is static but actual IP can be changed.
Any good idea?
The Application gateway IP address can change if the gateway is stopped and started by the customer.
So if you have not stop and start the application gateway, the IP address will not change.

Azure Virtual Machines(ARM) | Application Gateway | Private ip | DNS

I have an Internal application gateway configured in Azure. There is one virtual machine in the back end pool of application gateway which hosts the application. That is accessible via Intranet only.
I want the IP address of my internal application gateway to be associated to a domain name for my website?? How can i achieve this?
If you want to use a domain name, that means the application gateway needs to have a public IP address. In the gateway settings in the Azure portal, you can add a public IP address to the frontend configuration.
Looks like you already managed to put the backend of the gateway on the virtual network, that's good.
Next, you want to create a listener on the ports you need, for example 80 or 443. This is also done on the gateway configuration in the portal.
Finally, to use a domain name, you need to take the public IP address and put it in an A-record for the domain name. This would probably be in a config page with your service provider.

Resources