Skip to content

Commit 8e9e07c

Browse files
author
gitName
committed
[DO NOT MERGE][APIM] Private endpoint - Standard v2
1 parent 0548b5e commit 8e9e07c

File tree

3 files changed

+216
-0
lines changed

3 files changed

+216
-0
lines changed
57.3 KB
Loading
39.7 KB
Loading
Lines changed: 216 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,216 @@
1+
---
2+
title: Set up inbound private endpoint for Azure API Management - Standard v2
3+
description: Learn how to restrict inbound access to an Azure API Management instance by using an Azure private endpoint and Azure Private Link.
4+
ms.service: azure-api-management
5+
author: dlepow
6+
ms.author: danlep
7+
ms.topic: how-to
8+
ms.date: 09/19/2024
9+
---
10+
11+
# Set up inbound private endpoint for Azure API Management - Standard v2
12+
13+
[!INCLUDE [standard-v2.md](../../includes/api-management-availability-standard-v2.md)]
14+
15+
You can configure an inbound [private endpoint](../private-link/private-endpoint-overview.md) (preview) for your API Management Standard v2 instance to allow clients in your private network to securely access the API Management gateway over [Azure Private Link](../private-link/private-link-overview.md).
16+
17+
* The private endpoint uses an IP address from an Azure virtual network in which it's hosted.
18+
19+
* Network traffic between a client on your private network and API Management traverses over the virtual network and a Private Link on the Microsoft backbone network, eliminating exposure from the public internet.
20+
21+
* Configure custom DNS settings or an Azure DNS private zone to map the API Management hostname to the endpoint's private IP address.
22+
23+
:::image type="content" source="media/private-endpoint-v2-tiers/private-endpoint.png" alt-text="Diagram that shows a secure inbound connection to API Management using private endpoint.":::
24+
25+
With a private endpoint and Private Link, you can:
26+
27+
- Create multiple Private Link connections to an API Management instance.
28+
29+
- Use the private endpoint to send inbound traffic on a secure connection.
30+
31+
- Use policy to distinguish traffic that comes from the private endpoint.
32+
33+
- Limit incoming traffic only to private endpoints, preventing data exfiltration.
34+
35+
- Combine with outbound [virtual network integration](integrate-vnet-outbound.md) to provide end-to-end network isolation of your API Management clients and backend services.
36+
37+
38+
## Limitations
39+
40+
* Only the API Management instance's Gateway endpoint supports inbound Private Link connections.
41+
* Each API Management instance supports at most 100 Private Link connections.
42+
* The **Network** blade for the API Management Standard v2 instance in the Azure portal currently doesn't support creation or management of private endpoints.
43+
44+
As shown in this article, you create or manage private endpoint resources independently from the API Management instance.
45+
46+
## Prerequisites
47+
48+
- An existing API Management Standard v2 instance. [Create one if you haven't already](get-started-create-service-instance.md).
49+
- A virtual network containing a subnet to host the private endpoint. The subnet may contain other Azure resources.
50+
- (Recommended) A virtual machine in the same or a different subnet in the virtual network, to test the private endpoint.
51+
[!INCLUDE [azure-cli-prepare-your-environment-no-header.md](~/reusable-content/azure-cli/azure-cli-prepare-your-environment-no-header.md)]
52+
53+
## Approval method for private endpoint
54+
55+
Typically, a network administrator creates a private endpoint. Depending on your Azure role-based access control (RBAC) permissions, a private endpoint that you create is either *automatically approved* to send traffic to the API Management instance, or requires the resource owner to *manually approve* the connection.
56+
57+
58+
|Approval method |Minimum RBAC permissions |
59+
|---------|---------|
60+
|Automatic | `Microsoft.Network/virtualNetworks/**`<br/>`Microsoft.Network/virtualNetworks/subnets/**`<br/>`Microsoft.Network/privateEndpoints/**`<br/>`Microsoft.Network/networkinterfaces/**`<br/>`Microsoft.Network/locations/availablePrivateEndpointTypes/read`<br/>`Microsoft.ApiManagement/service/**`<br/>`Microsoft.ApiManagement/service/privateEndpointConnections/**` |
61+
|Manual | `Microsoft.Network/virtualNetworks/**`<br/>`Microsoft.Network/virtualNetworks/subnets/**`<br/>`Microsoft.Network/privateEndpoints/**`<br/>`Microsoft.Network/networkinterfaces/**`<br/>`Microsoft.Network/locations/availablePrivateEndpointTypes/read` |
62+
63+
## Steps to configure private endpoint
64+
65+
1. [Get available private endpoint types in subscription](#get-available-private-endpoint-types-in-subscription)
66+
1. [Create private endpoint - portal](#create-private-endpoint---portal)
67+
1. [List private endpoint connections to the instance](#list-private-endpoint-connections-to-the-instance)
68+
1. [Approve pending private endpoint connections](#approve-pending-private-endpoint-connections)
69+
1. [Optionally disable public network access](#optionally-disable-public-network-access)
70+
71+
### Get available private endpoint types in subscription
72+
73+
Verify that the API Management private endpoint type is available in your subscription and location. In the portal, find this information by going to the **Private Link Center**. Select **Supported resources**.
74+
75+
You can also find this information by using the [Available Private Endpoint Types - List](/rest/api/virtualnetwork/available-private-endpoint-types) REST API.
76+
77+
```rest
78+
GET https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{region}/availablePrivateEndpointTypes?api-version=2021-03-01
79+
```
80+
81+
Output should include the `Microsoft.ApiManagement.service` endpoint type:
82+
83+
```JSON
84+
[...]
85+
86+
"name": "Microsoft.ApiManagement.service",
87+
"id": "/subscriptions/{subscriptionId}/providers/Microsoft.Network/AvailablePrivateEndpointTypes/Microsoft.ApiManagement.service",
88+
"type": "Microsoft.Network/AvailablePrivateEndpointTypes",
89+
"resourceName": "Microsoft.ApiManagement/service",
90+
"displayName": "Microsoft.ApiManagement/service",
91+
"apiVersion": "2021-04-01-preview"
92+
}
93+
[...]
94+
```
95+
96+
### Create private endpoint - portal
97+
98+
1. In the [Azure portal](https://portal.azure.com/), go to the **Private Link Center**.
99+
100+
1. Select **Private endpoints** > **+ Create**.
101+
102+
1. In the **Basics** tab of **Create a private endpoint**, enter or select the following information:
103+
104+
| Setting | Value |
105+
| ------- | ----- |
106+
| **Project details** | |
107+
| Subscription | Select your subscription. |
108+
| Resource group | Select an existing resource group, or create a new one. It must be in the same region as your virtual network.|
109+
| **Instance details** | |
110+
| Name | Enter a name for the endpoint such as *myPrivateEndpoint*. |
111+
| Network Interface Name | Enter a name for the network interface, such as *myInterface* |
112+
| Region | Select a location for the private endpoint. It must be in the same region as your virtual network. It may differ from the region where your API Management instance is hosted. |
113+
114+
1. Select the **Next: Resource** button at the bottom of the screen. The following information about your API Management instance is already populated:
115+
* Subscription
116+
* Resource type
117+
* Resource name
118+
119+
1. In **Resource**, in **Target sub-resource**, select **Gateway**.
120+
121+
:::image type="content" source="media/private-endpoint/create-private-endpoint.png" alt-text="Screenshot showing settings to create a private endpoint in the Azure portal.":::
122+
123+
> [!IMPORTANT]
124+
> Only **Gateway** is supported for API Management. Other sub-resources aren't supported.
125+
126+
1. Select the **Next: Virtual Network** button at the bottom of the screen.
127+
128+
1. In **Networking**, enter or select this information:
129+
130+
| Setting | Value |
131+
| ------- | ----- |
132+
| Virtual network | Select your virtual network. |
133+
| Subnet | Select your subnet. |
134+
| Network policy for private endpoints | Leave the default of **Disabled**. |
135+
| Private IP configuration | In most cases, select **Dynamically allocate IP address.** |
136+
| Application security group | Optionally select an [application security group](../virtual-network/application-security-groups.md). |
137+
138+
1. Select the **Next: DNS** button at the bottom of the screen.
139+
140+
1. In **Private DNS integration**, enter or select this information:
141+
142+
| Setting | Value |
143+
| ------- | ----- |
144+
| Integrate with private DNS zone | Leave the default of **Yes**. |
145+
| Subscription | Select your subscription. |
146+
| Resource group | Select your resource group. |
147+
| Private DNS zones | The default value is displayed: **(new) privatelink.azure-api.net**.
148+
149+
1. Select the **Next: Tabs** button at the bottom of the screen. If you desire, enter tags to organize your Azure resources.
150+
151+
1. Select the **Next: Review + create** button at the bottom of the screen.
152+
153+
1. Select **Create**.
154+
155+
### List private endpoint connections
156+
157+
After the private endpoint is created and the service updated, it appears in the list on the **Private endpoints** page in the **Private Link Center**.
158+
159+
Confirm that the endpoint's **Connection status** is **Approved**.
160+
161+
### Optionally disable public network access
162+
163+
To optionally limit incoming traffic to the API Management instance only to private endpoints, disable public network access.
164+
165+
> [!NOTE]
166+
> Disabling the public network access property only affects API Management instances configured with a private endpoint.
167+
168+
To disable public network access using the Azure CLI, run the following [az apim update](/cli/azure/apim#az-apim-update) command, substituting the names of your API Management instance and resource group:
169+
170+
```azurecli
171+
az apim update --name my-apim-service --resource-group my-resource-group --public-network-access false
172+
```
173+
174+
You can also use the [API Management Service - Update](/rest/api/apimanagement/api-management-service/update) REST API to disable public network access, by setting the `publicNetworkAccess` property to `Disabled`.
175+
176+
## Validate private endpoint connection
177+
178+
After the private endpoint is created, confirm its DNS settings in the portal:
179+
180+
1. In the **Private Link Center**, select **Private endpoints** <name of your private endpoint>.
181+
182+
1. In the left-hand navigation, under **Settings**, select **DNS configuration**.
183+
184+
1. Review the DNS records and IP address of the private endpoint. The IP address is a private address in the address space of the subnet where the private endpoint is configured.
185+
186+
### Test in virtual network
187+
188+
Connect to a virtual machine you set up in the virtual network.
189+
190+
Run a utility such as `nslookup` or `dig` to look up the IP address of your default Gateway endpoint over Private Link. For example:
191+
192+
```
193+
nslookup my-apim-service.azure-api.net
194+
```
195+
196+
Output should include the private IP address associated with the private endpoint.
197+
198+
API calls initiated within the virtual network to the default Gateway endpoint should succeed.
199+
200+
### Test from internet
201+
202+
From outside the private endpoint path, attempt to call the API Management instance's default Gateway endpoint. If public access is disabled, output includes an error with status code `403` and a message similar to:
203+
204+
```
205+
Request originated from client public IP address xxx.xxx.xxx.xxx, public network access on this 'Microsoft.ApiManagement/service/my-apim-service' is disabled.
206+
207+
To connect to 'Microsoft.ApiManagement/service/my-apim-service', please use the Private Endpoint from inside your virtual network.
208+
```
209+
210+
## Related content
211+
212+
* Use [policy expressions](api-management-policy-expressions.md#ref-context-request) with the `context.request` variable to identify traffic from the private endpoint.
213+
* Learn more about [private endpoints](../private-link/private-endpoint-overview.md) and [Private Link](../private-link/private-link-overview.md), including [Private Link pricing](https://azure.microsoft.com/pricing/details/private-link/).
214+
* [Manage private endpoint connections](../private-link/manage-private-endpoint.md).
215+
* [Troubleshoot Azure private endpoint connectivity problems](../private-link/troubleshoot-private-endpoint-connectivity.md).
216+

0 commit comments

Comments
 (0)