How to keep web app to api app calls within ILB ASE - azure

I have web and api app deployed within ILB ASE fronted by Application Gateway.Would I be able to make the calls from my web app to api app without exposing api app externally? If so, how can I do that?
I configured application gateway to point to the front end web app. I created internet routable domain and added to custom domain in my web app. In my DNS, I pointed the custom domain to hostname of the application gateway and I am able to logon to my web app. But, I see my web app written in AngualarJS is making XMLHttpRequest to backend API URL and as the backend API URL can not be resolved from my desktop, it is failing.
My requirement is not to expose API app outside of the ILB ASE VNET. Any suggestions?

If you want the web app and API could communicate with each other in an ILB ASE, you need to deploy an internal DNS service. For example, you could deploy a custom DNS server on Azure VM in the same Azure VNet. You can specify DNS server IP addresses in the VNet settings. The VNet is your ASE subnet located.
Please note that restart ASE after DNS IP address is added to VNet if you add the DNS after you deploy ASE. You could refer to this and read more details about custom DNS in ASE. Let me know if this works.

Related

Azure web service ip address

I have a question regarding the IP address of my web application.
I deployed my app to azure. The application (API) has been successfully deployed to azure web service and for a client to make a request to the API, the IP address of the app is needed. In azure portal under properties I can find the virtual IP address (e.g. 20.10.200.5 typing it to the browser gives 404) and outbound API addresses.
How to make the API's virtual IP address reachable by clients ?
As an addition to Stanley's answer:
The App Service gets its own URL in the form of <appservice-name>.azurewebsites.net which can be used to access the application / API. You can also Map an existing custom DNS name to Azure App Service making the application / API available through your own domain, like yourdomain.com/api.
Unfortunately, you can't access an Azure App service directly by virtual IP. Virtual IP is bind to the App service plan, one App service plan could contain multiple Azure App services. App service plan maps the domain name with the individual app services, so using a virtual IP is not possible to do that.

how to add forward proxy to azure app service

I have azure app service which runs .net core web api. This api access several external API s to get data and those external services has to whitelist the outbound ip addresses of my app service.
Azure app service has several outbound ip addresses and it can be change when upgrade/downgrade app service or when make internal changes like changing app service plan or resource group.
Is there any solution in azure to setup this app service behind a forward proxy ?, so i can share the IP of the forward proxy to external parties.
I think the best way would be to add all App services under a virtual network and create a Virtual Network Gateway to all outbound connections.
This would potentially need below azure services to be created:
- Virtual network
- Subnet
- Virtual Network gateway
- Routing tables (to route traffic via Gateway)
A better way would be sharing a domain name rather than IP address. Here's how to configure it directly in the Azure Portal:
https://learn.microsoft.com/en-us/azure/app-service/app-service-web-tutorial-custom-domain
You can also add an API Management in front of your web app and use it as API gateway and also apply policies on it.
https://learn.microsoft.com/en-us/azure/api-management/configure-custom-domain

How to access on-prem resource from an App Service through Express Route?

I have an app service in Azure (not in ASE App Service Env). It is integrated with a vnet.
And I have an API on-premises that this app must access by its internal on-prem DNS name.
And there is an Express Route between Azure and on-prem location.
How to access the on-prem API by its DNS name through an Express Route?
How to configure network connectivity?
How to resolve on-premises names in Azure?
There are different ways of achieving that, depending on your set-up.
You might need to use:
App Service
For App Services you must use Regional VNet integration.
If you need all traffic from the App Service to be routed via the Vnet, you must specify in the app service the setting WEBSITE_VNET_ROUTE_ALL = 1
https://learn.microsoft.com/en-us/azure/app-service/web-sites-integrate-with-vnet#regional-vnet-integration
DNS
https://learn.microsoft.com/en-us/azure/virtual-network/virtual-networks-name-resolution-for-vms-and-role-instances
Troubleshoot DNS in App Service
https://learn.microsoft.com/en-us/azure/app-service/web-sites-integrate-with-vnet#troubleshooting
Configure Peering
https://learn.microsoft.com/en-us/azure/expressroute/expressroute-howto-routing-portal-resource-manager
Route tables for VNets (not always necesary)
https://learn.microsoft.com/en-us/azure/virtual-network/manage-route-table

How will fix Inaccessible issue for function app created in ILB ASE in azure?

I am trying to create a function app in azure ILB ASE but failed to open Kudu due to its inaccessibility. How I configure it correctly?
Since the Azure function is deployed in ILB ASE, it can only be accessed from the virtual network. If you want to access the function outside the VNet, you need to deploy a public Azure application gateway to expose the internal endpoint. The Azure application gateway will work as a reverse proxy to route the incoming traffic to the appropriate endpoint.
References:
Integrate your ILB App Service Environment with the Azure Application Gateway
Private Function Apps in Azure Government using App Service Environment (ASE)
Take a look at this issue - Document how to use Functions in an ILB ASE and this link, make sure you meet the requirements.
Be in the same vnet as your ILB ASE
Have a valid cert for the default domain and the default scm domain. *.yourILBDomain.com and *.scm.yourILBDomain.com
In addition to having a certificate, you also must configure the DNS for the ILB domain.

How to call an API inside an Azure ILB ASE from a webapp within the same ASE

I have an Azure ILB ASE deployed, and a webapp deployed inside it at (for example) https://myapp.my-internal domain. I have an Application Gateway configured, mapping an external domain name to that app via the ILB, and this works well - I can connect to the webapp from the internet via the Application Gateway, as expected.
My webapp needs to talk to an API deployed to the same ILB ASE, at (for example) https://myapi.my-internal-domain - but when it tries to make this connection, it fails, being unable to resolve the internal domain name:
How can I configure my web app so it can find an api app within the same ILB ASE?
I will summarize the comment to let others who have same question get answer quickly.
To to manually overwrite the MS default DNS settings and use the internal DNS server for web app service, the solution is to add Website_DNS_Server= primary DNS server IP and Website_DNS_ALT_Server=secondary DNS server IP” under the App Settings in webapp.
Don't forget to point the address of each app to the ILB private IP in Azure DNS zone.
For more details, you could refer to this article.

Resources