Skip to content

Commit abd27fe

Browse files
Merge pull request #310802 from dlepow/nsp
[APIM] Add NSP article
2 parents 2691e37 + cbbf7fc commit abd27fe

5 files changed

Lines changed: 191 additions & 0 deletions

File tree

articles/api-management/TOC.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@
129129
href: protect-with-ddos-protection.md
130130
- name: Configure Front Door
131131
href: front-door-api-management.md
132+
- name: Access resource protected by network security perimeter
133+
href: using-network-security-perimeter.md
132134
- name: Configuration management
133135
items:
134136
- name: Landing zone accelerator

articles/api-management/breaking-changes/trusted-service-connectivity-retirement-march-2026.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ You can configure the networking of target resources to one of the following opt
101101

102102
- [Transition to a Network Security Perimeter in Azure](/azure/private-link/network-security-perimeter-transition)
103103

104+
- [How to front a network security perimeter-protected Azure resource with Azure API Management](../using-network-security-perimeter.md)
105+
104106
### Step 3: Disable trusted service connectivity in API Management gateway
105107

106108
After ensuring that your API Management gateway doesn't access other Azure services using trusted service connectivity, you must explicitly disable trusted connectivity in your gateway to acknowledge you have verified that the service no longer depends on trusted connectivity.
46.4 KB
Loading
57.5 KB
Loading
Lines changed: 187 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,187 @@
1+
---
2+
title: How to front a network security perimeter-protected Azure resource with Azure API Management
3+
description: Step-by-step guidance to secure an Azure service backend with a network security perimeter and access it via Azure API Management using managed identity.
4+
ms.service: azure-api-management
5+
ms.topic: how-to
6+
ms.date: 01/27/2026
7+
author: dlepow
8+
ms.author: danlep
9+
ai-usage: ai-assisted
10+
---
11+
12+
# How to front a network security perimeter-protected Azure resource with Azure API Management
13+
14+
This article shows how to secure an Azure service resource with an Azure [network security perimeter](/azure/private-link/network-security-perimeter-concepts) and access it through Azure API Management.
15+
16+
As an example, you configure an Azure Storage account with a network security perimeter to allow traffic from your subscription (containing the API Management instance), use API Management's managed identity to authenticate to Azure Storage, and verify access with the API Management test console. Trusted service connectivity and public access to the storage account will be disabled.
17+
18+
## Why use a network security perimeter with API Management?
19+
20+
A network security perimeter provides a supported, centralized perimeter to explicitly allow traffic while keeping public access disabled. It provides:
21+
22+
- **Modern token trust model:** Managed identity tokens now include trust mode claims that no longer permit implicit network bypass. A network security perimeter establishes the explicit network path your backend requires.
23+
- **Centralized governance:** A network security perimeter consolidates per‑service network rules into a single perimeter, improving consistency and observability across protected resources.
24+
- **Works without a virtual network:** For API Management instances not isolated with a virtual network, network security perimeter enables secure access by subscription or IP range. If virtual network isolation is available and preferred, you can continue to use that approach.
25+
26+
> [!NOTE]
27+
> Beginning March 2026, [API Management is retiring trusted service connectivity](breaking-changes/trusted-service-connectivity-retirement-march-2026.md) from the gateway to select backend Azure services. If those backends such as Azure storage accounts rely on trusted Microsoft services or resource instances for network access, you must migrate. A network security perimeter provides the supported, centralized perimeter to explicitly allow traffic while keeping public access disabled.
28+
29+
## Prerequisites
30+
31+
- An Azure subscription and Owner or Contributor permissions.
32+
- An Azure API Management instance with a system-assigned or user-assigned managed identity enabled.
33+
- An Azure Storage account
34+
- Configure a container and at least one test blob (for example, a JSON file).
35+
- To begin, enable public network access to the storage account. By default, this setting also enables trusted Microsoft services and resource instances to access the storage account. You modify access later when associating the network security perimeter.
36+
37+
## Overview of steps
38+
39+
1. Configure API Management to call Azure Storage using a managed identity.
40+
41+
1. Block public network access to the storage account.
42+
43+
1. Create a network security perimeter profile and associate the storage account.
44+
45+
1. Add an inbound access rule to allow API Management traffic.
46+
47+
1. Move network security perimeter access mode from **transition** to **enforced**.
48+
49+
## Step 1. Configure API Management to call Azure Storage by using managed identity
50+
51+
Configure API Management to call Azure Storage. Add a test API and operation, and configure a policy to authenticate by using API Management's managed identity.
52+
53+
1. In the [Azure portal](https://portal.azure.com/), go to your API Management instance.
54+
1. Ensure that a system-assigned or user-assigned managed identity is enabled. For steps, see [Use managed identities in API Management](api-management-howto-use-managed-service-identity.md).
55+
1. Go to the storage account and grant the managed identity access:
56+
1. In the left menu, select **Access control (IAM)** > **Add role assignment**.
57+
1. Select **Storage Blob Data Reader** role (or **Contributor**, if write access is required) and assign to the API Management managed identity.
58+
1. Complete the role assignment steps.
59+
60+
### Configure an API operation to call Azure Storage
61+
62+
1. Add an HTTP API that fronts the Azure Storage blob URI (for example, `https://<storage-account-name>.blob.core.windows.net/apimtest`).
63+
1. Add a GET operation targeting the container.
64+
:::image type="content" source="media/using-network-security-perimeter/api-operation.png" alt-text="Screenshot showing a sample API operation to access a blob container in the portal.":::
65+
66+
1. On the **Design** tab, select the operation and then select the policy editor (`</>`). Edit the operation's policy definition to add the API version header and managed identity authentication.
67+
68+
In the following example:
69+
70+
* The `authentication-managed-identity` policy assumes that the API Management instance has a system-assigned managed identity enabled and can access Azure Storage. To use a user-assigned managed identity, set a `client-id` attribute in the policy. For more information, see the [policy reference](authentication-managed-identity-policy.md).
71+
* The `set-header` policy sets the [required Storage REST API version header](/rest/api/storageservices/get-blob?tabs=microsoft-entra-id#request-headers).
72+
73+
```xml
74+
<policies>
75+
<inbound>
76+
<base />
77+
<!-- Authenticate to Storage using API Management managed identity -->
78+
<authentication-managed-identity resource="https://storage.azure.com/" />
79+
<!-- Set Storage API version header -->
80+
<set-header name="x-ms-version" exists-action="override">
81+
<value>2025-11-05</value>
82+
</set-header>
83+
</inbound>
84+
<backend>
85+
<forward-request />
86+
</backend>
87+
<outbound>
88+
<base />
89+
</outbound>
90+
<on-error>
91+
<base />
92+
</on-error>
93+
</policies>
94+
```
95+
96+
> [!NOTE]
97+
> - The `resource` value should be `https://storage.azure.com/` for Azure Storage.
98+
> - Ensure the managed identity is assigned the appropriate RBAC role.
99+
100+
### Test the API operation
101+
102+
Before configuring the network security perimeter, test that the API operation can reach the storage account.
103+
104+
1. In the left menu, under **APIs**, select your API and operation.
105+
1. Select the **Test** tab.
106+
1. Select **Test** and call the operation. Optionally select **Trace** to capture detailed telemetry.
107+
108+
Expected results:
109+
- The call succeeds with a `200 OK` response and returns the blob content.
110+
- If you enabled **Trace**, you can verify that API Management added the managed identity token to the Authorization header.
111+
112+
## Step 2. Block public network access to the storage account
113+
114+
If you now block public network access to the storage account, the API call from API Management fails because trusted service connectivity is disabled.
115+
116+
1. In the Azure portal, go to your storage account.
117+
1. In the left menu, under **Security + networking**, select **Networking**.
118+
1. On the **Public access** tab, select **Manage**. **Disable** public network access.
119+
1. Select **Save**.
120+
121+
### Test the API operation
122+
123+
Test that the API operation can no longer reach the storage account.
124+
125+
1. In the Azure portal, go to your API Management instance.
126+
1. In the left menu, under **APIs**, select your API and operation.
127+
1. Select the **Test** tab.
128+
1. Select **Test** and call the operation. Optionally select **Trace** to capture detailed telemetry.
129+
130+
Expected result:
131+
- The call fails with a `403 Forbidden` response.
132+
133+
## Step 3. Create a network security perimeter profile and associate the storage account
134+
135+
For typical steps to create a network security perimeter and associate an Azure resource with a profile, see [Create a network security perimeter and profile](/azure/private-link/create-network-security-perimeter-portal). Brief steps follow:
136+
137+
1. In the Azure portal, search for **Network Security Perimeters** and select it.
138+
1. Select **+ Create** and provide a name and region. Accept the defaults for other settings and create the perimeter.
139+
1. After deployment, go to the **Settings** > **Associated resources** blade to associate the storage account with an existing or new profile.
140+
141+
## Step 4: Add an inbound access rule to allow API Management traffic
142+
143+
To allow API Management to reach the storage account through the perimeter, add an inbound rule. The simplest approach is by Azure subscription.
144+
145+
1. In the left menu of our network security perimeter, select **Settings** > **Profiles**, then select the profile you associated with the storage account.
146+
1. In the left menu, select **Settings** > **Inbound access rules** > **+ Add**:
147+
1. Enter a name for the rule.
148+
1. Select **Source type** *Subscriptions*, then in **Allowed sources** select the subscription that contains your API Management instance.
149+
1. Select **Add**.
150+
151+
> [!NOTE]
152+
> If you select IP address-based control, specify API Management's outbound public IP address range in the inbound rule. Ensure you include all outbound [IP addresses](api-management-howto-ip-addresses.md#ip-addresses-for-outbound-traffic) for your API Management instance.
153+
>
154+
155+
### Confirm the network configuration in the storage account
156+
157+
1. In the Azure portal, go to your storage account.
158+
1. In the left menu, under **Security + networking**, select **Networking**.
159+
1. Under **Network security perimeter**, confirm that the storage account is associated with your network security perimeter profile and that the access rule is listed.
160+
161+
:::image type="content" source="media/using-network-security-perimeter/public-access-settings.png" alt-text="Screenshot of public access settings in the storage account in the portal.":::
162+
163+
### Test the API operation
164+
165+
Test that the API operation can reach the storage account in the network security perimeter.
166+
167+
1. In the Azure portal, go to your API Management instance.
168+
1. In the left menu, under **APIs**, select your API and operation.
169+
1. Select the **Test** tab.
170+
1. Select **Test** and call the operation. Optionally select **Trace** to capture detailed telemetry.
171+
172+
Expected result:
173+
- The call succeeds with a `200 OK` response and returns the blob content.
174+
175+
## Step 5. Move access mode to enforced
176+
177+
A network security perimeter supports the following [access modes](/azure/private-link/network-security-perimeter-transition):
178+
179+
- **Transition:** Applies both existing per-resource network settings and network security perimeter rules. This mode is the default when you first associate a resource.
180+
- **Enforced:** Applies only network security perimeter rules. Use this mode once you validate access.
181+
182+
After you validate access in **transition** mode, set the network security perimeter's access mode to **enforced**. For more information, see [Steps to configure publicNetworkAccess and accessMode properties](/azure/private-link/network-security-perimeter-transition#steps-to-configure-publicnetworkaccess-and-accessmode-properties).
183+
184+
## Related content
185+
186+
- Learn more about [network security perimeter concepts and capabilities](/azure/private-link/network-security-perimeter-concepts)
187+
- [Networking options in API Management](virtual-network-concepts.md)

0 commit comments

Comments
 (0)