Connect privately to API Management using an inbound private endpoint
სტატია
APPLIES TO: Developer | Basic | Standard | Standard v2 | Premium
You can configure an inbound private endpoint for your API Management instance to allow clients in your private network to securely access the instance over Azure Private Link.
Note
Private endpoint support in the Standard v2 tier is currently in limited preview. To sign up, fill this form.
The private endpoint uses an IP address from an Azure virtual network in which it's hosted.
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.
Configure custom DNS settings or an Azure DNS private zone to map the API Management hostname to the endpoint's private IP address.
With a private endpoint and Private Link, you can:
Create multiple Private Link connections to an API Management instance.
Use the private endpoint to send inbound traffic on a secure connection.
Use policy to distinguish traffic that comes from the private endpoint.
Limit incoming traffic only to private endpoints, preventing data exfiltration.
Combine inbound private endpoints to Standard v2 instances with outbound virtual network integration to provide end-to-end network isolation of your API Management clients and backend services.
მნიშვნელოვანი
You can only configure a private endpoint connection for inbound traffic to the API Management instance.
Limitations
Only the API Management instance's Gateway endpoint supports inbound Private Link connections.
Each API Management instance supports at most 100 Private Link connections.
If you prefer to run CLI reference commands locally, install the Azure CLI. If you're running on Windows or macOS, consider running Azure CLI in a Docker container. For more information, see How to run the Azure CLI in a Docker container.
If you're using a local installation, sign in to the Azure CLI by using the az login command. To finish the authentication process, follow the steps displayed in your terminal. For other sign-in options, see Sign in with the Azure CLI.
When you're prompted, install the Azure CLI extension on first use. For more information about extensions, see Use extensions with the Azure CLI.
Run az version to find the version and dependent libraries that are installed. To upgrade to the latest version, run az upgrade.
Approval method for private endpoint
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.
Get available private endpoint types in subscription
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.
GET https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{region}/availablePrivateEndpointTypes?api-version=2021-03-01
Output should include the Microsoft.ApiManagement.service endpoint type:
Network policies such as network security groups must be disabled in the subnet used for the private endpoint.
If you use tools such as Azure PowerShell, the Azure CLI, or REST API to configure private endpoints, update the subnet configuration manually. For examples, see Manage network policies for private endpoints.
When you use the Azure portal to create a private endpoint, as shown in the next section, network policies are disabled automatically as part of the creation process.
Create private endpoint - portal
You can create a private endpoint for your API Management instance in the Azure portal.
In the classic API Management tiers, you can create a private endpoint when you create the instance. In an existing instance, use the instance's Network blade in the Azure portal.
Navigate to your API Management service in the Azure portal.
In the left-hand menu, under Deployment + infrastructure, select Network.
In the Basics tab of Create a private endpoint, enter or select the following information:
Setting
Value
Project details
Subscription
Select your subscription.
Resource group
Select an existing resource group, or create a new one. It must be in the same region as your virtual network.
Instance details
Name
Enter a name for the endpoint such as myPrivateEndpoint.
Network Interface Name
Enter a name for the network interface, such as myInterface
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.
Select the Next: Resource button at the bottom of the screen. The following information about your API Management instance is already populated:
Subscription
Resource type
Resource name
In Resource, in Target sub-resource, select Gateway.
მნიშვნელოვანი
Only the Gateway sub-resource is supported for API Management. Other sub-resources aren't supported.
Select the Next: Virtual Network button at the bottom of the screen.
In Virtual Network, enter or select this information:
Setting
Value
Virtual network
Select your virtual network.
Subnet
Select your subnet.
Private IP configuration
In most cases, select Dynamically allocate IP address.
Select the Next: DNS button at the bottom of the screen.
In Private DNS integration, enter or select this information:
Setting
Value
Integrate with private DNS zone
Leave the default of Yes.
Subscription
Select your subscription.
Resource group
Select your resource group.
Private DNS zones
The default value is displayed: (new) privatelink.azure-api.net.
Select the Next: Tabs button at the bottom of the screen. If you desire, enter tags to organize your Azure resources.
Select the Next: Review + create button at the bottom of the screen. Select Create.
List private endpoint connections to the instance
After the private endpoint is created and the service updated, it appears in the list on the API Management instance's Inbound private endpoint connections page in the portal.
Note the endpoint's Connection status:
Approved indicates that the API Management resource automatically approved the connection.
Pending indicates that the connection must be manually approved by the resource owner.
Approve pending private endpoint connections
If a private endpoint connection is in pending status, an owner of the API Management instance must manually approve it before it can be used.
If you have sufficient permissions, approve a private endpoint connection on the API Management instance's Private endpoint connections page in the portal. In the connection's context (...) menu, select Approve.
Currently you can't set up a private endpoint when creating a Standard v2 instance or using the instances's Network blade in the Azure portal.
As shown in this article, you must create and manage private endpoint resources separately from an API Management Standard v2 instance.
In the Azure portal, go to the Private Link Center.
Select Private endpoints > + Create.
In the Basics tab of Create a private endpoint, enter or select the following information:
Setting
Value
Project details
Subscription
Select your subscription.
Resource group
Select an existing resource group, or create a new one. It must be in the same region as your virtual network.
Instance details
Name
Enter a name for the endpoint such as myPrivateEndpoint.
Network Interface Name
Enter a name for the network interface, such as myInterface
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.
Select the Next: Resource button at the bottom of the screen.
In Resource, enter or select this information:
Setting
Value
Subscription
Your subscription is selected.
Resource type
Select Microsoft.ApiManagement/service.
Resource
Select your API Management Standard v2 instance.
Target sub-resource
Select Gateway.
მნიშვნელოვანი
Only the Gateway sub-resource is supported for API Management. Other sub-resources aren't supported.
Select the Next: Virtual Network button at the bottom of the screen.
In Virtual Network, enter or select this information:
Setting
Value
Virtual network
Select your virtual network.
Subnet
Select your subnet.
Network policy for private endpoints
Leave the default of Disabled.
Private IP configuration
In most cases, select Dynamically allocate IP address.
To disable the public network access property using the Azure CLI, run the following az apim update command, substituting the names of your API Management instance and resource group:
Azure CLI
az apim update --name my-apim-service--resource-group my-resource-group--public-network-accessfalse
You can also use the API Management Service - Update REST API to disable public network access, by setting the publicNetworkAccess property to Disabled.
To disable the public network access property in a Standard v2 instance using the Azure CLI, run the following az rest command.
Navigate to your API Management service in the Azure portal.
In the left-hand menu, under Deployment + infrastructure, select Network > Inbound private endpoint connections, and select the private endpoint you created.
In the left-hand navigation, under Settings, select DNS configuration.
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.
In the Private Link Center, select Private endpoints and then the name of your private endpoint.
In the left-hand navigation, under Settings, select DNS configuration.
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.
Test in virtual network
Connect to a virtual machine you set up in the virtual network.
Run a utility such as nslookup or dig to look up the IP address of your default Gateway endpoint over Private Link. For example:
Output should include the private IP address associated with the private endpoint.
API calls initiated within the virtual network to the default Gateway endpoint should succeed.
Test from internet
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:
Request originated from client public IP address 192.0.2.12, public network access on this 'Microsoft.ApiManagement/service/my-apim-service' is disabled.
To connect to 'Microsoft.ApiManagement/service/my-apim-service', please use the Private Endpoint from inside your virtual network.
Related content
Use policy expressions with the context.request variable to identify traffic from the private endpoint.
შემოუერთდით Meetup სერიას, რათა შექმნათ მასშტაბური AI გადაწყვეტილებები რეალურ სამყაროში გამოყენების შემთხვევებზე დაყრდნობით თანამემამულე დეველოპერებთან და ექსპერტებთან.
Learn how to securely connect an Azure SQL server using an Azure Private Endpoint via the Azure portal, ensuring private and safe communication with your SQL server.