Managing a Distributed API Estate Efficiently with Azure API Management and Self-Hosted Gateways
For platform teams, the architectural gain here is not just distribution โ it is control over where the gateway lives relative to the workload. Self-hosted gateways let API traffic terminate close to the consuming or producing system, which can reduce detours across regions or back into Azure. The trade-off is that latency improvements come with extra operational responsibility: you own the gateway runtime, its placement, and the availability pattern of the underlying infrastructure.
The real design decision is the split between data plane and management plane. Requests can flow locally through the self-hosted gateway, while policy, configuration, and telemetry remain centrally governed by Azure APIM. That separation is useful for standardisation, but it also creates a dependency on reliable outbound connectivity for heartbeat, updates, and logs. In regulated or segmented environments, network design becomes part of the API architecture, not a follow-up task.
Authentication and lifecycle management deserve special attention. The gateway must maintain trust with APIM, so key handling, rotation, and identity strategy affect both security posture and operational load. Using a stronger identity-based approach reduces the risk of credential exposure and avoids brittle manual rotation processes, but it also adds an Azure identity dependency that teams need to design, monitor, and document.
Scaling is another area where ownership changes hands. Because the gateway runs outside the managed APIM service, capacity planning shifts to the team operating the environment. That means autoscaling policy, pod health, and failover behavior should be treated as part of API reliability engineering. For distributed estates, the value is a single policy model with local execution โ but only if the surrounding platform is engineered with the same discipline as the APIs themselves.
- Support for distributed APIs with minimal latency overhead.
- A secure faรงade for APIs, which hides the underlying API differences from the end user.
- And importantly, a single management plane for the entire estate
- Azure APIM instance, comprising Developer Portal (a fully configurable website that provides a central location for API discovery, experimentation, testing, and reuse), Gateway, and Management Plane (an interface for managing your APIM instance, including how your APIs are exposed, protected, and versioned). The APIM is configured in Internal Mode to prevent the instance from being directly publicly accessible. The instance is only accessible via the configured App Gateway, or via a peered network.
- SHGW container* deployed on a third-party cloud platform (e.g. AWS, GCP).
- SHGW container* deployed on on-premises resources.
- Management connectivity between SHGW and APIM management plane, allowing transmission of SHGW heartbeat, configuration updates, log shipment. Connection is outbound from SHGW on port 443.
- ExpressRoute dedicated on-premises to Azure connection (optional).
- Network peering between APIM subnet and on-premises network, allowing direct connectivity between the APIM instance and on-premises services, including the SHGW.
- Public point of ingress for all APIM services.
- API consumer, accessing Azure, on-premises, and third-party cloud APIs via Azure GW and SHGW. For access to non-Azure APIs traffic goes direct to the closest gateway, not via Azure.
- Connectivity between the SHGW and the Azure. Outbound connectivity is required from a SHGW to APIM and certain Azure services such as Azure Storage and Application Insights in order to pull configuration changes, for log shipment, heartbeat, and other operational necessities. Will you go via the internet, or remain on a private network? Private networking between on-premises SHGW and Azure can be achieved via network peering and a dedicated circuit such as ExpressRoute. It is also possible to peer a third-party cloud platform and Azure via a dedicated connection from third-party to on-premises and back up to Azure.
- Authentication. To authenticate with APIM, SHGW presents an authentication key which by default is stored in the SHGW container. However, this is a poor solution which risks exposing the key and increases administration effort – it needs to be rotated every 30 days, and if forgotten the SHGW will lose its connectivity. A better solution is to use Entra authentication, see https://learn.microsoft.com/en-us/azure/api-management/self-hosted-gateway-enable-azure-ad.
- Scalability. If using SHGW you are responsible for scaling the gateway, consider using Kubernetes horizontal pod autoscaler to scale out the gateway.
Enjoyed this article? Sign up for our newsletter to receive regular insights and stay connected.
