API Management - Networking FAQs (Demystifying Series II) (2024)

This is a continuation of demystifying common issues faced while integrating API Management instance in a virtual network. You can find part-I here.

FAQ Scenarios

  • APIM with Azure Firewall
  • Using custom DNS with APIM
  • Force tunneling traffic from Azure to on-premises over ExpressRoute or VPN

APIM with Azure Firewall

API Management instance can be configured to run in a VNET internal or external mode. Azure Firewall can be used to control and monitor the APIM subnet traffic.

Can you run APIM in VNET external mode with user-defined route forcing default traffic to Azure firewall?

No. This configuration will not work as client will try to access API Management Gateway/proxy on its public IP address but the response from API Management Gateway will be forwarded to Azure Firewall.

Azure Firewall being fully-stateful will drop the response traffic.

Scenario: Forcing APIM subnet traffic through Azure Firewall using user-defined routes.

For monitoring purposes, we create user-defined routes to point default traffic (0.0.0.0/0) from API subnet to Azure Firewall.

API Management - Networking FAQs (Demystifying Series II) (1)

Route table having user-defined route (named FW) pointing default traffic (denoted with address prefix as 0.0.0.0/0) to the next hop as Azure Firewall.

API Management - Networking FAQs (Demystifying Series II) (2)

With the above rule, management traffic (managing the APIM configuration using Azure portal or PowerShell) response is also forced through Azure Firewall.

With the above configuration in place, you observe that API are not loaded and keep on loading the page. If you inspect the network trace, you will observe the Management endpoint not reachable error.

API Management - Networking FAQs (Demystifying Series II) (3)

Error message in the developer console

Failed to connect to management endpoint servicename.management.azure-api.net:3443 for a service deployed in a Virtual Network. Make sure to follow guidance at https://aka.ms/apim-vnet-common-issues.

API Management - Networking FAQs (Demystifying Series II) (4)

Solution:

We must route the management endpoint response traffic directly to internet to avoid response traffic getting dropped by Azure Firewall.

This can be achieved by adding routes in the route table associated with APIM subnet.

API Management - Networking FAQs (Demystifying Series II) (5)

We must add user defined routes for the control plane IP address with next hop as internet. The above image shows routes for global control plane IP address and region-specific IP address. You can find the control plane IP address for the specific region in https://docs.microsoft.com/en-us/azure/api-management/api-management-using-with-vnet#--control-plane...

API Management - Networking FAQs (Demystifying Series II) (6)

Using custom DNS with APIM

Can I use azure default DNS server for APIM?

Yes, you can use azure default DNS server in the following conditions:

  • if your solution/architecture does not require connectivity to on-premises or you are not accessing on-premises resources using hostnames.
  • if all your backend servers are hosted in azure environment.

What is the limitation of default azure DNS?

When creating a Virtual Network, Azure provides default DNS server "168.63.129.16". You can check this under Virtual Network-> DNS Severs blade. This DNS server is used for name resolution for azure services but it cannot provide name resolution for on-premise resources.

API Management - Networking FAQs (Demystifying Series II) (7)

When do we need custom DNS for APIM VNET?

When APIM is running in internal or external VNET mode and your backend APIs are hosted in on-prem servers, you establish private connectivity to the on-premise network using ExpressRoute or Site to Site VPN.

The on-prem servers will host the APIs. Although you can enable communications by using IP addresses, it is much simpler to use names that can be easily remembered, and do not change.

Azure default DNS server cannot resolve on-prem host names. So, we add and manage custom DNS servers for name resolution purposes. We must also take steps to resolve the Azure services as well by using DNS forwarder. Custom DNS should resolve on-premises resources and forwarder will resolve the azure resources.

Please note that forwarding to "168.63.129.16" will not work outside Azure i.e if your custom DNS server is in on-premises, you cannot forward queries to "168.63.129.16" to resolve Azure services.

An example DNS forwarder is available in theAzure Quickstart Templates galleryandGitHub

Example:

API Management - Networking FAQs (Demystifying Series II) (8)

Why network connectivity show failures with custom DNS server?

APIM has dependencies on other resources like SQL and storage. When custom DNS server is configured and if it cannot resolve the Azure services dependency, you will notice network connectivity failures.

API Management - Networking FAQs (Demystifying Series II) (9)

Example: Failed to connect to https://westeurope.prod.warm.ingestion.msftcloudes.com with error The remote name could not be resolved: 'westeurope.prod.warm.ingestion.msftcloudes.com'

This is because of custom DNS is not resolving or forwarding DNS queries to azure. We need to manage the DNS records or forward DNS queries as mentioned here https://docs.microsoft.com/en-us/azure/virtual-network/virtual-networks-name-resolution-for-vms-and-...

How can I check if my custom DNS server is resolving azure services?

You can use nslookup command to test if the custom DNS server is able to resolve the Azure services. RDP into any virtual machine in virtual network and test the nslookup command for the Azure PaaS services or on-premises hostnames. You can find the name of the azure services in Network connectivity status blade.

API Management - Networking FAQs (Demystifying Series II) (10)

Force tunneling traffic from Azure to on-premises over ExpressRoute or VPN

When APIM is running in VNET external or internal mode, we often see virtual network is connected to on-premises network using Site-to-Site VPN or ExpressRoute.

API Management - Networking FAQs (Demystifying Series II) (11)

What is the significance of force tunneling?

Force tunneling lets you redirect or "force" all Internet-bound traffic back to your on-premises location via a Site-to-Site VPN tunnel for inspection and auditing. This is a critical security requirement for most enterprise IT policies. Without force tunneling, Internet-bound traffic from your APIM Vnet will traverse from Azure network infrastructure directly out to the Internet, without the option to allow you to inspect or audit the traffic. Unauthorized Internet access can potentially lead to information disclosure or other types of security breaches.

Ways to do force tunneling:

  1. Force tunneling over Site-to-Site VPN (without BGP - Border Gateway Protocol ) Force tunneling in Azure is configured via virtual network user-defined routes pointing default traffic to the next hop as Virtual Network Gateway. Post this, you need to set a "default site" among the cross-premises local sites connected to the virtual network. Refer here: https://docs.microsoft.com/en-us/azure/vpn-gateway/vpn-gateway-forced-tunneling-rm#:~:text=Forced%20...

Force tunneling can also be configured on Site-to-Site VPN tunnel with BGP (commonly called as BGP over IPsec) where default route is advertised by on-premises to Azure over BGP sessions.

  1. Force tunneling over ExpressRoute: Force tunneling is enabled by advertising a default route via the ExpressRoute BGP peering sessions. To know more about asymmetric route with ExpressRoute -https://docs.microsoft.com/en-us/azure/expressroute/expressroute-asymmetric-routing#asymmetric-routi...

API Management - Networking FAQs (Demystifying Series II) (12)

What is effect of force tunneling APIM traffic?

With force tunneling, default/Internet traffic from APIM subnet is forced to flow through on-premises which could lead to below possibilities:

  • On-premises firewall might block internet traffic and connectivity to APIM instance is lost.
  • APIs will never load from portal since the Resource provider will access Management endpoint on its public IP addresses but the response is force tunneled to on-premises which will be blocked by fully-stateful firewalls.

What is asymmetric route?

In Asymmetric routing, a packet traverses from a source to a destination in one path and takes a different path when it returns to the source.

What is the solution for asymmetric route?

We must avoid routing outgoing response from API Management subnet to on-premises. To achieve this, we must add precise user defined route to force the traffic through internet.

The APIM Resource Provider uses a set of static IP addresses called as control plane IP addresses. You can find control plane Ip addresses inhttps://docs.microsoft.com/en-us/azure/api-management/virtual-network-reference?tabs=stv2#control-pl...

List of control plane IP address to be added in route table,

Regardless of the region your APIM instance is running, you must add global control plane IP address.

Azure Environment

Region

IP Address

Azure Public

South Central US (Global)

104.214.19.224

Azure Public

North Central US (Global)

52.162.110.80

Azure Public

East US

52.224.186.99

Find the IP address of the specific region your APIM instance is running and add.

Finally, the UDR will have the following routes as shown in the below image.

API Management - Networking FAQs (Demystifying Series II) (13)

Why APIM reporting Network Connectivity Status issues after adding UDR to force traffic to on-premises firewall?

Since APIM subnet traffic is routed to on-premises firewall and it blocks the connectivity to azure services. You would notice warnings and errors under Network Connectivity Status blade . This network connectivity issues will cause degradation in the ability to use monitor the API Management service.

The below images showing issues with such dependencies.

API Management - Networking FAQs (Demystifying Series II) (14)

To resolve the network connectivity issues, we must whitelist these services in on-premises firewall or you can add additional precise routes in the route table.

For Azure Monitor we can add IP address prefix 13.92.40.223/32 with next hop as Internet as shown below.

API Management - Networking FAQs (Demystifying Series II) (15)

API Management - Networking FAQs (Demystifying Series II) (2024)

FAQs

Does APIM need a dedicated subnet? ›

The subnet used to connect to the API Management instance must be dedicated to API Management.

What are the network options for API Management? ›

There are 4 network options for Azure API Management: Internal vNet Integration, External vNet Integration, Private Endpoint for APIM, and None. Make sure you understand network options and how they affect different components of APIM from documentation: Azure API Management with an Azure virtual network.

How can I secure the connection between the API Management gateway and my backend services? ›

You have several options to secure the connection between the API Management gateway and your backend services, including:
  1. Use subscription key authentication. ...
  2. Use TLS mutual authentication as described in How to secure back-end services by using client certificate authentication in Azure API Management.

What is the subnet size for API Management? ›

Subnet size

The minimum size of the subnet in which API Management can be deployed is /29, which provides three usable IP addresses. Each extra scale unit of API Management requires two more IP addresses.

Should API gateway be in a public subnet? ›

To ensure high availability, you can only create API gateways in regional subnets (not AD-specific subnets). You can create private API gateways in private or public subnets, but you can only create public API gateways in public subnets.

What is the difference between API gateway and APIM? ›

Relationship and Key Differences Between API Gateway and API Management. In a word, the API gateway is a core element of the API management platform. While the gateway handles API traffic routing and security, the management platform covers the entire API lifecycle, ranging from API design to API monetization.

What are the 4 types of API? ›

What are the different web API types?
  • Open APIs. Public APIs (or Open APIs) function through a set of tools, routines, and protocols for developing software applications. ...
  • Partner APIs. ...
  • Internal APIs. ...
  • Composite APIs.
May 2, 2023

Does API need network connection? ›

Communication Over a Network

However, APIs aren't required to utilize networks. Of course, they can, but they may also function offline. For example, two apps on the same computer may integrate via APIs. You can still transfer data without a network.

What is the most common API protocol? ›

API Protocol Types | The 8 Most Commonly Used API Protocols
  • REST (Representational State Transfer) ...
  • GraphQL. ...
  • SOAP (Simple Object Access Protocol)/Web Service. ...
  • WebSocket. ...
  • Socket. ...
  • SSE (Server-Sent Events) ...
  • gRPC (gRPC Remote Procedure Call) ...
  • MsgPack (MessagePack)
Oct 19, 2023

Should API gateway be behind load balancer? ›

In most cases, a combination of API gateways and load balancers is the ideal setup. The API gateway serves as the front door, managing security, routing, and transformations, while the load balancer distributes traffic efficiently across the backend servers behind it.

What is the difference between service registry and API gateway? ›

APIs provide a standardized way for services to communicate with each other, while service discovery allows them to locate and communicate with each other dynamically. Registry, on the other hand, enables services to register and discover other services, as well as manage metadata and configurations.

Which is the most secure way to transmit API key? ›

TLS (Transport Layer Security): Transport Layer Security (TLS) is an important security protocol that ensures the data transmitted between two systems, such as an API client and server, is encrypted and secure.

What is the maximum message size in API gateway? ›

API Gateway supports message payloads up to 128 KB with a maximum frame size of 32 KB. If a message exceeds 32 KB, you must split it into multiple frames, each 32 KB or smaller. If a larger message is received, the connection is closed with code 1009.

Does Azure bastion require a subnet named AzureBastionSubnet? ›

When you deploy Azure Bastion using any SKU except the Developer SKU, Bastion requires a dedicated subnet named AzureBastionSubnet. You must create this subnet in the same virtual network that you want to deploy Azure Bastion to. The subnet must have the following configuration: Subnet name must be AzureBastionSubnet.

What is the subnet requirement for Azure Application Gateway? ›

Application Gateway (Standard_v2 or WAF_v2 SKU) can support up to 125 instances (125 instance IP addresses + 1 private frontend IP configuration + 5 Azure reserved). We recommend a minimum subnet size of /24.

What are the requirements for API gateway? ›

API Gateway Requirements Table
  • Must have API authentication. ...
  • Must have good policy management. ...
  • Must protect against attacks. ...
  • Must provide protocol conversion. ...
  • Must have traffic management. ...
  • Must support the API lifecycle. ...
  • Must have identity management. ...
  • Must provide access control.

Does APIM need programmed? ›

Even though an active IDS/FJDS subscription is required for programming, the actual programming (VIP Vehicle Interface) is performed through the PTS website. To initialize the APIM programming the PTS site will need to identify the vehicle with a FORD VCI (VCM, VCM2,VCMM, VCM3).

Top Articles
Latest Posts
Article information

Author: Tyson Zemlak

Last Updated:

Views: 5431

Rating: 4.2 / 5 (63 voted)

Reviews: 86% of readers found this page helpful

Author information

Name: Tyson Zemlak

Birthday: 1992-03-17

Address: Apt. 662 96191 Quigley Dam, Kubview, MA 42013

Phone: +441678032891

Job: Community-Services Orchestrator

Hobby: Coffee roasting, Calligraphy, Metalworking, Fashion, Vehicle restoration, Shopping, Photography

Introduction: My name is Tyson Zemlak, I am a excited, light, sparkling, super, open, fair, magnificent person who loves writing and wants to share my knowledge and understanding with you.