Skip to content

Commit e796a8b

Browse files
committed
work in progress; renamed file
1 parent 2e6b803 commit e796a8b

10 files changed

+180
-102
lines changed
Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
---
2+
title: Deploy Azure Front Door in front of Azure API Management
3+
description: Learn how to front your API Management instance with an instance of Azure Front Door.
4+
services: api-management
5+
author: dlepow
6+
7+
ms.service: api-management
8+
ms.topic: how-to
9+
ms.date: 08/22/2022
10+
ms.author: danlep
11+
---
12+
# Create Front Door in front of Azure API Management
13+
14+
Ref: https://techcommunity.microsoft.com/t5/azure-paas-blog/integrate-azure-front-door-with-azure-api-management/ba-p/2654925
15+
16+
Azure Front Door is a modern application delivery network platform providing a secure, scalable content delivery network (CDN), dynamic site acceleration, and global HTTP(s) load balancing for your global web applications.
17+
18+
Azure Front Door supports ... and offers always-on availability, low latency, SSL offload, health probes, etc. etc. For a full list of supported features, see [What is Azure Front Door?](../frontdoor/front-door-overview.md).
19+
20+
This article provides detailed steps to set up Azure Front Door Standard/Premium in front of the API gateway of a publicly accessible Azure API Management instance. It also shows the steps to restrict API Management to accept API traffic only from Azure Front Door. You can configure Front Door in this scenario with either:
21+
22+
- A non-networked API Management instance
23+
- An API Management instance injected in a virtual network in [external mode](api-management-using-with.vnet.md) (currently supported only in the Developer and Premium service tiers)
24+
25+
## Prerequisites
26+
27+
* An API Management instance. The instance must be in the same subscription you use for your Azure Front Door profile. If you choose to use a network-injected instance, it must be deployed in an external VNet.
28+
* The instance's gateway endpoint can be configured with a [custom domain](). However,if you are going to route traffic using HTTPS via port 443, only certificates from valid certificate authorities can be used at the backend (origin) with Front Door. Certificates from internal CAs or self-signed certificates aren't allowed.
29+
* Import one or more APIs to your API Management instance to confirm routing through Front Door.
30+
31+
## Configure Azure Front Door
32+
33+
### Create profile
34+
35+
For steps to create an Azure Front Door Standard/Premium profile, see [Quickstart: Create an Azure Front Door profile - Azure portal](../frontdoor/create-front-door-portal.md). For this article, you may choose a Front Door Standard profile. For a comparison of Front Door Standard and Front Door Premium, see [Tier comparison](../frontdoor/standard-premium/tier-comparison.md).
36+
37+
Configure the following settings that are specific to using your API Management instance as a Front Door origin. For an explanation of other settings, see the Front Door quickstart.
38+
39+
|Setting |Value |
40+
|---------|---------|
41+
| **Origin type** | Select **API Management** |
42+
| **Origin hostname** | Enter the hostname of your API Management instance, for example, *myapim*.azure-api.net |
43+
| **Caching** | Select **Enable caching** for Front Door to [cache static content](../frontdoor/front-door-caching.md?pivots=front-door-standard-premium) |
44+
| **Query string caching behavior** | Select **Use Query String** |
45+
46+
:::image type="content" source="media/front-door-api-management/quick-create-front-door-profile.png" alt-text="Screenshot of creating a Front Door profile in the portal.":::
47+
48+
### Update default origin group
49+
50+
After the profile is created, update the default origin group that was created to include an API Management health probe.
51+
52+
1. In the [portal](https://portal.azure.com), go to your Front Door profile.
53+
1. In the left menu, under **Settings** select **Origin groups** > **default-origin-group**.
54+
1. In the **Update origin group** window, configure the following **Health probe** settings and select **Update**:
55+
56+
57+
|Setting |Value |
58+
|---------|---------|
59+
|**Status** | Select **Enable health probes** |
60+
|**Path** | Enter `/status-0123456789abcdef` |
61+
|**Protocol** | Select **HTTPS** |
62+
|**Method** | Select **GET** |
63+
|**Interval (in seconds)** | Enter **30** |
64+
65+
:::image type="content" source="media/front-door-api-management/update-origin-group.png" alt-text="Screenshot of updating the default origin group in the portal.":::
66+
67+
68+
### Update default route [is this needed?]
69+
70+
Update the default route that is configured in the profile.
71+
72+
1. In the [portal](https://portal.azure.com), go to your Front Door profile.
73+
1. In the left menu, under **Settings** select **Origin groups**.
74+
1. Expand **default-origin-group**.
75+
1. In the context menu (**...**) of **default-rout**, select **Configure route**.
76+
1. Set **Forwarding protocol** to **Match incoming request** and then select **Update**.
77+
78+
79+
### Test the configuration
80+
81+
Test the Front Door profile configuration by calling an API hosted by API Management. First call the API directly through the API Management gateway to ensure that that the API is reachable. Then, call the API through Front Door. To test, you can use a command line client such as `curl` for the calls, or a tool such as [Postman](https://www.getpostman.com).
82+
83+
### Call an API directly through API Management
84+
85+
In the following example, an operation in the Demo Conference API hosted by an API Management instance is called directly using Postman. The instance's hostname is in the `azure-api.net` domain. In this example, a valid subscription key is passed using a request header. A successful response shows `200 OK` and returns the expected data:
86+
87+
:::image type="content" source="media/front-door-api-management/test-api-management-gateway.png" alt-text="Screenshot showing calling API Management endpoint directly using Postman.":::
88+
89+
### Call an API directly through Front Door
90+
91+
92+
In the following example, the same operation in the Demo Conference API is called using the Front Door endpoint configured for your instance. You can find the Front Door endpoint's hostname on the **Properties** page of your Front Door profile in the portal. The hostname is the `azurefd.net` domain. Again, a successful response shows `200 OK` and returns the expected data:
93+
94+
:::image type="content" source="media/front-door-api-management/test-front-door-gateway.png" alt-text="Screenshot showing calling Front Door endpoint using Postman.":::
95+
96+
97+
## Restrict incoming traffic to API Management instance
98+
99+
100+
You can configure API Management policies so that the API Management accepts traffic only from Azure Front Door. You can accomplish this restriction using one or both of the [following methods](../frontdoor/front-door-faq.md#how-do-i-lock-down-the-access-to-my-backend-to-only-azure-front-door-):
101+
102+
1. Restrict incoming IP addresses to your API Management instances
103+
1. Restrict traffic based on value of the `X-Azure-FDID` header
104+
d
105+
106+
### Restrict incoming IP addresses
107+
108+
You can configure the [ip-filter](/api-management-access-restriction-policies.md#CheckHTTPHeader) policy to filter incoming requests based on the following Azure infrastructure IP addresses:
109+
*
110+
*
111+
112+
113+
114+
### Check Front Door header
115+
116+
You can configure the [check-header](/api-management-access-restriction-policies.md#CheckHTTPHeader) policy to filter incoming requests based on the `X-Azure-FDID` HTTP request header. Azure Front Door sends this header to API Management with its unique Front Door ID. You can find the **Front Door ID** value on the **Overview** page of the Front Door profile in the portal.
117+
118+
In the following policy example, the Front Door ID is specified using a [named value](api-management-howto-properties.md) named `FrontDoorId`.
119+
120+
```xml
121+
<check-header name="X-Azure-FDID" failed-check-httpcode="403" failed-check-error-message="Invalid request." ignore-case="false">
122+
<value>{{FrontDoorId}}</value>
123+
</check-header>
124+
```
125+
126+
Requests that are not accompanied by a valid `X-Azure-FDID` header return a `403 Forbidden` response.
127+
128+
Restrict Inbound IP
129+
130+
Restrict Inbound IP to accept traffic from Azure Front Door's backend IP address space and Azure's infrastructure services only.
131+
132+
133+
134+
External Virtual Network Type APIM
135+
136+
For APIM instance deployed as external VNet mode, we can simply restrict the incoming IP using inbound rule in the network security groups of your APIM subnet.
137+
138+
* Allow service tag **AzureFrontDoor.Backend** in inbound rule for port 443. (Is it also needed for port 80?)
139+
* Also allow incoming traffic from Azure's basic infrastructure services through virtualized host IP addresses: 168.63.129.16 and 169.254.169.254
140+
* If your APIM service isn’t deployed into Vnet (None for the Virtual Network type), then there’s nowhere you can put the inbound rule in. But you can still leverage APIM IP restriction policy to achieve this goal. See policy doc here: https://docs.microsoft.com/en-us/azure/api-management/api-management-access-restriction-policies#Res....
141+
142+
Allow Azure Front Door Backend Ips. Refer AzureFrontDoor.Backend section in Azure IP Ranges and Service Tags for Front Door's IPv4 backend IP address range.
143+
144+
### Check Front Door header
145+
146+
```xml
147+
<check-header name="X-Azure-FDID" failed-check-httpcode="403" failed-check-error-message="Invalid request." ignore-case="false">
148+
<value>{{FrontDoorId}}</value>
149+
</check-header>
150+
```
151+
152+
153+
154+
## (Optional) Configure Front Door for developer portal
155+
\\
156+
157+
158+
## Next steps
159+
160+
To automate deployments, see the following Quickstart Templates:
161+
162+
* [Front Door Standard/Premium with API Management origin](https://azure.microsoft.com/resources/templates/front-door-standard-premium-api-management-external/)
163+
164+
165+
166+
============
167+
168+
169+
170+
* Backend pool - API Management service
171+
* Health probe settings to gatway: - Path `/status-0123456789abcdef`, HTTPS, GET method, 30 sec interval
172+
* Health probe settings to developer portal ?
173+
* Routing rules
174+
* Gateway - HTTPS only? Match incoming requests?
175+
176+
* Developer portal
177+
178+
* Considerations for multi-region - regional origins?
179+
180+

articles/api-management/front-door-in-front-of-api-management.md

Lines changed: 0 additions & 102 deletions
This file was deleted.
126 KB
Loading
166 KB
Loading
181 KB
Loading

0 commit comments

Comments
 (0)