Skip to content

Commit 98c9681

Browse files
Azure Docs: API Management (#554)
Co-authored-by: Brian Rinaldi <brian.rinaldi@gmail.com>
1 parent bc73c8c commit 98c9681

1 file changed

Lines changed: 268 additions & 3 deletions

File tree

src/content/docs/azure/services/api-management.mdx

Lines changed: 268 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,275 @@
11
---
2-
title: "API Management"
3-
description: API coverage for Microsoft.ApiManagement in LocalStack for Azure.
2+
title: 'API Management'
3+
description: Get started with Azure API Management on LocalStack
44
template: doc
55
---
66

7-
import AzureFeatureCoverage from "../../../../components/feature-coverage/AzureFeatureCoverage";
7+
import AzureFeatureCoverage from '../../../../components/feature-coverage/AzureFeatureCoverage';
8+
9+
## Introduction
10+
11+
Azure API Management (APIM) is a managed service for publishing, securing, and analyzing APIs at scale.
12+
It acts as a gateway between clients and backend services, providing features such as rate limiting, policy enforcement, authentication, and developer portal integration.
13+
14+
APIM is commonly used to expose internal services as managed APIs, implement API versioning, and monitor API usage across organizations. For more information, see [Azure API Management overview](https://learn.microsoft.com/en-us/azure/api-management/api-management-key-concepts).
15+
16+
LocalStack for Azure provides a local environment for building and testing applications that make use of Azure API Management.
17+
The supported APIs are available on our [API Coverage section](#api-coverage), which provides information on the extent of API Management's integration with LocalStack.
18+
19+
## Getting started
20+
21+
This guide walks you through creating an API Management service, adding an API, and defining and updating an operation. It is designed for users new to API Management and assumes basic knowledge of the Azure CLI and our `azlocal` wrapper script.
22+
23+
Launch LocalStack using your preferred method. For more information, see [Introduction to LocalStack for Azure](/azure/getting-started/). Once the container is running, enable Azure CLI interception by running:
24+
25+
```bash
26+
azlocal start-interception
27+
```
28+
29+
This command points the `az` CLI away from the public Azure management REST API and toward the LocalStack for Azure emulator API.
30+
To revert this configuration, run:
31+
32+
```bash
33+
azlocal stop-interception
34+
```
35+
36+
This reconfigures the `az` CLI to send commands to the official Azure management REST API.
37+
38+
### Create a resource group
39+
40+
Create a resource group for your API Management resources:
41+
42+
```bash
43+
az group create \
44+
--name rg-apim-demo \
45+
--location westeurope
46+
```
47+
48+
```bash title="Output"
49+
{
50+
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-apim-demo",
51+
"location": "westeurope",
52+
"name": "rg-apim-demo",
53+
"properties": {
54+
"provisioningState": "Succeeded"
55+
},
56+
...
57+
}
58+
```
59+
60+
### Create an API Management service instance
61+
62+
Create an API Management service in the resource group:
63+
64+
```bash
65+
az apim create \
66+
--name apimdoc86 \
67+
--resource-group rg-apim-demo \
68+
--location westeurope \
69+
--sku-name Consumption \
70+
--publisher-name "LocalStack" \
71+
--publisher-email "dev@localstack.cloud"
72+
```
73+
74+
```bash title="Output"
75+
{
76+
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-apim-demo/providers/Microsoft.ApiManagement/service/apimdoc86",
77+
"name": "apimdoc86",
78+
"location": "West Europe",
79+
"provisioningState": "Succeeded",
80+
"publisherName": "LocalStack",
81+
"publisherEmail": "dev@localstack.cloud",
82+
"gatewayUrl": "https://apimdoc86.azure-api.net",
83+
"sku": {
84+
"capacity": 0,
85+
"name": "Consumption"
86+
},
87+
...
88+
}
89+
```
90+
91+
Get and list API Management services:
92+
93+
```bash
94+
az apim show \
95+
--name apimdoc86 \
96+
--resource-group rg-apim-demo
97+
```
98+
99+
```bash title="Output"
100+
{
101+
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-apim-demo/providers/Microsoft.ApiManagement/service/apimdoc86",
102+
"location": "West Europe",
103+
"name": "apimdoc86",
104+
"provisioningState": "Succeeded",
105+
"publisherEmail": "dev@localstack.cloud",
106+
"publisherName": "LocalStack",
107+
"resourceGroup": "rg-apim-demo",
108+
"sku": { "capacity": 0, "name": "Consumption" },
109+
"type": "Microsoft.ApiManagement/service"
110+
...
111+
}
112+
```
113+
114+
```bash
115+
az apim list \
116+
--resource-group rg-apim-demo
117+
```
118+
119+
```bash title="Output"
120+
[
121+
{
122+
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-apim-demo/providers/Microsoft.ApiManagement/service/apimdoc86",
123+
"name": "apimdoc86",
124+
"provisioningState": "Succeeded",
125+
"resourceGroup": "rg-apim-demo",
126+
"sku": { "capacity": 0, "name": "Consumption" },
127+
"type": "Microsoft.ApiManagement/service"
128+
}
129+
]
130+
```
131+
132+
### Check service name availability
133+
134+
Check whether the service name is globally available before creating:
135+
136+
```bash
137+
az apim check-name --name apimdoc86
138+
```
139+
140+
```bash title="Output"
141+
{
142+
"message": "",
143+
"nameAvailable": true,
144+
"reason": "Valid"
145+
}
146+
```
147+
148+
### Create and inspect an API
149+
150+
Create an API in API Management:
151+
152+
```bash
153+
az apim api create \
154+
--resource-group rg-apim-demo \
155+
--service-name apimdoc86 \
156+
--api-id orders-api \
157+
--path orders \
158+
--display-name "Orders API" \
159+
--protocols https
160+
```
161+
162+
```bash title="Output"
163+
{
164+
"displayName": "Orders API",
165+
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-apim-demo/providers/Microsoft.ApiManagement/service/apimdoc86/apis/orders-api",
166+
"name": "orders-api",
167+
"path": "orders",
168+
"protocols": [
169+
"https"
170+
],
171+
"subscriptionRequired": true,
172+
...
173+
}
174+
```
175+
176+
Get the API:
177+
178+
```bash
179+
az apim api show \
180+
--resource-group rg-apim-demo \
181+
--service-name apimdoc86 \
182+
--api-id orders-api
183+
```
184+
185+
```bash title="Output"
186+
{
187+
"displayName": "Orders API",
188+
"name": "orders-api",
189+
"path": "orders",
190+
"protocols": [
191+
"https"
192+
],
193+
...
194+
}
195+
```
196+
197+
### Create and update an API operation
198+
199+
Create an operation on the API:
200+
201+
```bash
202+
az apim api operation create \
203+
--resource-group rg-apim-demo \
204+
--service-name apimdoc86 \
205+
--api-id orders-api \
206+
--operation-id get-orders \
207+
--display-name "Get orders" \
208+
--method GET \
209+
--url-template "/orders"
210+
```
211+
212+
```bash title="Output"
213+
{
214+
"displayName": "Get orders",
215+
"method": "GET",
216+
"name": "get-orders",
217+
"type": "Microsoft.ApiManagement/service/apis/operations",
218+
"urlTemplate": "/orders",
219+
...
220+
}
221+
```
222+
223+
Update the operation and verify the change:
224+
225+
```bash
226+
az apim api operation update \
227+
--resource-group rg-apim-demo \
228+
--service-name apimdoc86 \
229+
--api-id orders-api \
230+
--operation-id get-orders \
231+
--display-name "Get all orders"
232+
233+
az apim api operation show \
234+
--resource-group rg-apim-demo \
235+
--service-name apimdoc86 \
236+
--api-id orders-api \
237+
--operation-id get-orders
238+
```
239+
240+
```bash title="Output"
241+
{
242+
"displayName": "Get all orders",
243+
"method": "GET",
244+
"name": "get-orders",
245+
"urlTemplate": "/orders",
246+
...
247+
}
248+
```
249+
250+
## Features
251+
252+
- **Full CRUD lifecycle:** Create, read, update, and delete APIM service instances.
253+
- **API management:** Create, read, and delete API definitions within a service.
254+
- **API operations:** Register and retrieve API operation definitions.
255+
- **Backend management:** Define and manage backend service configurations.
256+
- **API gateway management:** Create and manage self-hosted API gateways.
257+
- **API policies:** Attach XML policy documents to APIs (stored but not evaluated).
258+
- **Name availability check:** Validate service name uniqueness via the `checkNameAvailability` action.
259+
- **Service listing:** List all APIM services in a subscription or resource group.
260+
261+
## Limitations
262+
263+
- **No gateway proxy:** Incoming API calls are not proxied through LocalStack. The APIM gateway does not process requests, apply policies, or forward traffic to backends.
264+
- **No policy evaluation:** Inbound, outbound, and error policies are stored in the ARM model but are not executed.
265+
- **No developer portal:** The APIM developer portal and its OAuth/subscription flows are not emulated.
266+
- **No subscription keys:** API subscriptions and key-based authentication are not enforced.
267+
- **No rate limiting or quotas:** Throttling, quota, and cache policies have no effect.
268+
- **Consumption plan only for creation:** SKU differences between Developer, Basic, Standard, Premium, and Consumption tiers are not emulated.
269+
270+
## Samples
271+
272+
Explore end-to-end examples in the [LocalStack for Azure Samples](https://github.com/localstack/localstack-azure-samples) repository.
8273
9274
## API Coverage
10275

0 commit comments

Comments
 (0)