Skip to content

Deployment of Internal VNET API Management consuming APIs from Internal ASE. Accessing the APIM through Application gateway

Notifications You must be signed in to change notification settings

ssarwa/API-Management-ASE-AppGateway

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Access API Management service consuming APIs from App Service Environments on internal VNET using Application Gateway

There are few scenarios where organizations host multiple APIs using App Service Environments and would want to make use of these APIs using API Management service. The API Management could also be exposed to external users (as well as Internal developers) as well to utlize the full potential of the APIs. This could be achieved using Application Gateways connected to Internal API Management service which inturn consumes apps in ASE. The most interesting part was since both App Service Env and APIM services were hosted internally on the VNET, having them working together took new challenges. This requires adding HOST headers to APIM service and consume the APIs using ASE’s DNS.

Architecture

alt

Challenges we faced

Prereqs

  1. Custom Domain Name purchased (like on godaddy)
  2. Since we are using actual custom domain, procuring a SSL certificates (we used a wild card one from Azure Certificates Service) to use one for all our custom domains

Deployment in sequence of resources and putting the pieces together

The deployment process was in the sequence as below

  1. VNET with the following configurations: ase-internal-vnet
  • Address space for VNET: 10.0.0.0/16
  • 4 Subnets
    • backendSubnet for DNS Service: 10.0.0.0/24
    • apimsubnet for Internal API Management Service: 10.0.1.0/28
    • asesubnet for ILB ASE: 10.0.2.0/24
    • VMSubnet for Test VMs and Internal DevOps Hosted Agent VM: 10.0.3.0/24
  1. Private DNS service (Public Preview) since adding a DNS service requires the VNET to be empty. We used our custom domain purchased on godaddy: sarwascloud.com
  1. App Service Environment with Internal Load Balancer (ILB) option: aseinternal (DNS: aseinternal.sarwascloud.com)
  2. Uploaded the wild car cert for the ILB
  • Created App Service Plan with ASE as location
  • Created two API Apps (App Services for simplicity)
  • Created an Cosmos DB service for web APIs hosted internal to VNET: noderestapidb
  • Created DNS entries on the Private DNS zone created
  1. Configured CI/CD pipelines for the above Apps using Github as source repo and Azure DevOps for pipelines
  • Configured a Build Agent VM internal to the VNET for the release pipeline for deploying the API Apps: asevm
  1. Used a testVM to test the API Apps working internally on the VNET
  2. Created API Management service: apim-internal
  • Configured the service to connect to intern VNET on Subnet: apimsubnet
  • Configured custom domains for APIM Services using SSL Cert
    • API portal (api.sarwascloud.com)
    • Dev Portal (portal.sarwascloud.com)
  • In the APIs section, configured the ASE Apps using ASE’s DNS name added Policy for HOST Header to differentiate the APIs (ASP.NET vs NodeJS)
  1. Used the above created testVM to test the API Management service internally
  • Remember the testing the APIM APIs from Azure portal will still NOT work as we don’t have api.sarwascloud.com not be able to publicly resolve
  1. Configured Application Gateway (WAF V1) to access the APU service: apim-gateway
  1. Configured the DNS entries in Godaddy CNAME entries of api.sarwascloud.com and portal.sarwascloud.com with App Gateway’s public DNS name: ase-appgtwy.westus.cloudapp.azure.com

Once we have the above resources configured, we were able to

Reach the Dev Portal from Public
Able to test the APIM services APIs using Azure Portal

Note that it is not a good practice to use same URL for Internal and External Devs for the APIM services (currently in the above demo, both URLs are same). If we want to choose to have different URLs for internal and external devs, we could make use of App Gateway WAF v2 which supports http redirection and much more.

About

Deployment of Internal VNET API Management consuming APIs from Internal ASE. Accessing the APIM through Application gateway

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published