Skip to content

Commit 982f544

Browse files
Merge pull request #296994 from v-albemi/function-app-api
AI Freshness Edit: Azure API Management
2 parents 17db81a + c1a27e2 commit 982f544

File tree

6 files changed

+78
-76
lines changed

6 files changed

+78
-76
lines changed
Lines changed: 78 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,169 +1,171 @@
11
---
22
title: Import an Azure Function App as an API in API Management
33
titleSuffix: Azure API Management
4-
description: This article shows you how to import an Azure Function App into Azure API Management as an API.
4+
description: Learn how to import an Azure function app into Azure API Management as an API.
55
services: api-management
66
author: dlepow
77
ms.service: azure-api-management
88
ms.topic: how-to
9-
ms.date: 04/16/2021
9+
ms.date: 03/28/2025
1010
ms.author: danlep
11+
12+
#customer intent: As an API developer, I want to import an Azure function app as an API in API Management.
1113
---
1214

13-
# Import an Azure Function App as an API in Azure API Management
15+
# Import an Azure function app as an API in Azure API Management
1416

1517
[!INCLUDE [api-management-availability-all-tiers](../../includes/api-management-availability-all-tiers.md)]
1618

17-
Azure API Management supports importing Azure Function Apps as new APIs or appending them to existing APIs. The process automatically generates a host key in the Azure Function App, which is then assigned to a named value in Azure API Management.
19+
Azure API Management supports importing Azure function apps as new APIs or appending them to existing APIs. The process automatically generates a host key in the Azure function app, which is then assigned to a named value in API Management.
1820

1921
[!INCLUDE [api-management-workspace-availability](../../includes/api-management-workspace-availability.md)]
2022

21-
This article walks through importing and testing an Azure Function App as an API in Azure API Management.
23+
This article describes how to import an Azure function app as an API to Azure API Management and test the API.
2224

23-
You will learn how to:
25+
You'll learn how to:
2426

2527
> [!div class="checklist"]
26-
> * Import an Azure Function App as an API
27-
> * Append an Azure Function App to an API
28-
> * View the new Azure Function App host key and Azure API Management named value
28+
> * Import an Azure function app as an API
29+
> * Append an Azure function app to an API
30+
> * View the new function app host key and API Management named value
2931
> * Test the API in the Azure portal
3032
3133
## Prerequisites
3234

3335
* Complete the [Create an Azure API Management instance](get-started-create-service-instance.md) quickstart.
34-
* Make sure you have an Azure Functions app in your subscription. For more information, see [Create an Azure Function App](../azure-functions/functions-get-started.md). Functions must have HTTP trigger and authorization level set to *Anonymous* or *Function*.
36+
* Make sure you have an Azure function app in your subscription. For more information, see [Getting started with Azure Functions](../azure-functions/functions-get-started.md). The function must have an HTTP trigger. The authorization level must be set to *Anonymous* or *Function*.
3537

3638
> [!NOTE]
37-
> You can use the API Management Extension for Visual Studio Code to import and manage your APIs. Follow the [API Management Extension tutorial](visual-studio-code-tutorial.md) to install and get started.
38-
39-
[!INCLUDE [api-management-navigate-to-instance.md](../../includes/api-management-navigate-to-instance.md)]
39+
> You can also use the API Management Extension for Visual Studio Code to import and manage your APIs. Complete the [API Management Extension tutorial](visual-studio-code-tutorial.md) to get started.
4040
41-
## <a name="add-new-api-from-azure-function-app"></a> Import an Azure Function App as a new API
41+
## Import an Azure function app as a new API
4242

43-
Follow the steps below to create a new API from an Azure Function App.
43+
To create a new API from an Azure function app:
4444

45-
1. Navigate to your API Management service in the Azure portal and select **APIs** from the menu.
45+
1. Navigate to your API Management service in the Azure portal.
46+
1. Select **APIs** > **APIs** in the left pane.
4647

47-
2. In the **Add a new API** list, select **Function App**.
48+
1. Under **Create from Azure resource**, select **Function App**:
4849

49-
:::image type="content" source="./media/import-function-app-as-api/add-01.png" alt-text="Screenshot that shows the Function App tile.":::
50+
:::image type="content" source="./media/import-function-app-as-api/add-01.png" alt-text="Screenshot that shows the Function App tile in the Azure portal.":::
5051

51-
3. Click **Browse** to select Functions for import.
52+
1. Select the **Browse** button:
5253

53-
:::image type="content" source="./media/import-function-app-as-api/add-02.png" alt-text="Screenshot that highlights the Browse button.":::
54+
:::image type="content" source="./media/import-function-app-as-api/add-02.png" alt-text="Screenshot that highlights the Browse button." lightbox="./media/import-function-app-as-api/add-02.png":::
5455

55-
4. Click on the **Function App** section to choose from the list of available Function Apps.
56+
1. Click the **Select** button under **Configure required settings** to choose from the list of available function apps:
5657

57-
:::image type="content" source="./media/import-function-app-as-api/add-03.png" alt-text="Screenshot that highlights the Function App section.":::
58+
:::image type="content" source="./media/import-function-app-as-api/add-03.png" alt-text="Screenshot that shows the Select button." lightbox="./media/import-function-app-as-api/add-03.png":::
5859

59-
5. Find the Function App you want to import Functions from, click on it and press **Select**.
60+
1. Find the function app that you want to import functions from, select it, and then click **Select**:
6061

61-
:::image type="content" source="./media/import-function-app-as-api/add-04.png" alt-text="Screenshot that highlights the Function App you want to import Functions from and the Select button.":::
62+
:::image type="content" source="./media/import-function-app-as-api/add-04.png" alt-text="Screenshot that shows a function app and the Select button." lightbox="./media/import-function-app-as-api/add-04.png":::
6263

63-
6. Select the Functions you would like to import and click **Select**.
64-
* You can only import Functions based off HTTP trigger with *Anonymous* or *Function* authorization levels.
64+
1. Select the functions that you want to import and click **Select**. You can only import functions that have an HTTP trigger and an *Anonymous* or *Function* authorization level.
6565

66-
:::image type="content" source="./media/import-function-app-as-api/add-05.png" alt-text="Screenshot that highlights the Functions to import and the Select button.":::
66+
:::image type="content" source="./media/import-function-app-as-api/add-05.png" alt-text="Screenshot that shows a function and the Select button." lightbox="./media/import-function-app-as-api/add-05.png":::
6767

68-
7. Switch to the **Full** view and assign **Product** to your new API.
69-
8. If needed, specify other fields during creation or configure them later via the **Settings** tab.
70-
* The settings are explained in the [Import and publish your first API](import-and-publish.md#import-and-publish-a-backend-api) tutorial.
68+
1. Switch to the **Full** view and assign a **Product** to your new API.
7169

72-
>[!NOTE]
73-
> Products are associations of one or more APIs offered to developers through the developer portal. First, developers must subscribe to a product to get access to the API. Once subscribed, they get a subscription key for any API in that product. As creator of the API Management instance, you are an administrator and are subscribed to every product by default.
70+
>[!NOTE]
71+
> *Products* are associations of one or more APIs that are offered to developers via the developer portal. First, developers must subscribe to a product to get access to the API. When they subscribe, they get a subscription key for any API in the product. If you created the API Management instance, you're an administrator and are subscribed to every product by default.
7472
>
75-
> Each API Management instance comes with two default sample products:
73+
> In some pricing tiers, API Management instances come with two default sample products:
7674
> - **Starter**
7775
> - **Unlimited**
7876
79-
9. Click **Create**.
77+
1. As needed, specify other settings. You can also specify settings later via the **Settings** tab. These settings are explained in the [Import and publish your first API](import-and-publish.md#import-and-publish-a-backend-api) tutorial.
78+
79+
80+
81+
1. Select **Create**.
8082

81-
## <a name="append-azure-function-app-to-api"></a> Append Azure Function App to an existing API
83+
## Append a function app to an existing API
8284

83-
Follow the steps below to append Azure Function App to an existing API.
85+
To append a function app to an existing API:
8486

85-
1. In your **Azure API Management** service instance, select **APIs** from the menu on the left.
87+
1. In your **Azure API Management** service instance, select **APIs** > **APIs** in the left pane.
8688

87-
2. Choose an API you want to import an Azure Function App to. Click **...** and select **Import** from the context menu.
89+
1. Choose an API that you want to import a function app to. Select the ellipsis (**...**) next to the API, and then select **Import**:
8890

89-
:::image type="content" source="./media/import-function-app-as-api/append-function-api-1.png" alt-text="Screenshot that highlights the Import menu option.":::
91+
:::image type="content" source="./media/import-function-app-as-api/append-function-api-1.png" alt-text="Screenshot that shows the Import menu option." lightbox="./media/import-function-app-as-api/append-function-api-1.png":::
9092

91-
3. Click on the **Function App** tile.
93+
1. Select the **Function App** tile:
9294

93-
:::image type="content" source="./media/import-function-app-as-api/append-function-api-2.png" alt-text="Screenshot that highlights the Function App tile.":::
95+
:::image type="content" source="./media/import-function-app-as-api/append-function-api-2.png" alt-text="Screenshot that shows the Function App tile." lightbox="./media/import-function-app-as-api/append-function-api-2.png":::
9496

95-
4. In the pop-up window, click **Browse**.
97+
1. In the **Import from Function App window**, select **Browse**:
9698

97-
:::image type="content" source="./media/import-function-app-as-api/append-function-api-3.png" alt-text="Screenshot that shows the Browse button.":::
99+
:::image type="content" source="./media/import-function-app-as-api/append-function-api-3.png" alt-text="Screenshot that shows the Browse button." lightbox="./media/import-function-app-as-api/append-function-api-3.png":::
98100

99-
5. Click on the **Function App** section to choose from the list of available Function Apps.
101+
1. Click the **Select** button under **Configure required settings** to choose from the list of available function apps:
100102

101-
:::image type="content" source="./media/import-function-app-as-api/add-03.png" alt-text="Screenshot that highlights the list of Function Apps.":::
103+
:::image type="content" source="./media/import-function-app-as-api/add-03.png" alt-text="Screenshot that shows the Function App section." lightbox="./media/import-function-app-as-api/add-03.png":::
102104

103-
6. Find the Function App you want to import Functions from, click on it and press **Select**.
105+
1. Find the function app you want to import functions from, select it, and then click **Select**:
104106

105-
:::image type="content" source="./media/import-function-app-as-api/add-04.png" alt-text="Screenshot that highlights the Function App you want to import functions from.":::
107+
:::image type="content" source="./media/import-function-app-as-api/add-04.png" alt-text="Screenshot that shows the function app and the Select button." lightbox="./media/import-function-app-as-api/add-04.png":::
106108

107-
7. Select the Functions you would like to import and click **Select**.
109+
1. Select the functions that you want to import, and then click **Select**:
108110

109-
:::image type="content" source="./media/import-function-app-as-api/add-05.png" alt-text="Screenshot that highlights the functions you'd like to import.":::
111+
:::image type="content" source="./media/import-function-app-as-api/add-05.png" alt-text="Screenshot that shows the list of functions." lightbox="./media/import-function-app-as-api/add-05.png":::
110112

111-
8. Click **Import**.
113+
1. Select **Import**:
112114

113-
:::image type="content" source="./media/import-function-app-as-api/append-function-api-4.png" alt-text="Append from Function App":::
115+
:::image type="content" source="./media/import-function-app-as-api/append-function-api-4.png" alt-text="Screenshot that shows the Import button." lightbox="./media/import-function-app-as-api/append-function-api-4.png":::
114116

115-
## <a name="authorization"></a> Authorization
117+
## Authorization
116118

117-
Import of an Azure Function App automatically generates:
119+
When you import an Azure function app, these items are automatically generated:
118120

119-
* Host key inside the Function App with the name apim-{*your Azure API Management service instance name*},
120-
* Named value inside the Azure API Management instance with the name {*your Azure Function App instance name*}-key, which contains the created host key.
121+
* A host key in the function app. The key is named `apim-<your API Management service instance name>`.
122+
* A named value in the API Management instance that has the name `<your Azure function app instance name>-key`. This value contains the host key.
121123

122-
For APIs created after April 4th 2019, the host key is passed in HTTP requests from API Management to the Function App in a header. Older APIs pass the host key as [a query parameter](../azure-functions/functions-bindings-http-webhook-trigger.md#api-key-authorization). You can change this behavior through the `PATCH Backend` [REST API call](/rest/api/apimanagement/current-ga/backend/update#backendcredentialscontract) on the *Backend* entity associated with the Function App.
124+
For APIs created after April 4, 2019, the host key is passed in HTTP requests from API Management to the function app in a header. Older APIs pass the host key as [a query parameter](../azure-functions/functions-bindings-http-webhook-trigger.md#api-key-authorization). You can change this behavior by using the `PATCH Backend` [REST API call](/rest/api/apimanagement/current-ga/backend/update#backendcredentialscontract) on the `Backend` entity that's associated with the function app.
123125

124126
> [!WARNING]
125-
> Removing or changing either the Azure Function App host key value or the Azure API Management named value will break the communication between the services. The values do not sync automatically.
127+
> Removing or changing either the Azure function app host key value or the API Management named value will disable communication between the services. The values don't automatically sync.
126128
>
127-
> If you need to rotate the host key, make sure the named value in Azure API Management is also modified.
129+
> If you need to rotate the host key, be sure to also change the named value in API Management.
128130
129-
### Access Azure Function App host key
131+
### Access a function app host key
130132

131-
1. Navigate to your Azure Function App instance.
133+
1. Navigate to your Azure function app instance:
132134

133-
:::image type="content" source="./media/import-function-app-as-api/keys-01.png" alt-text="Screenshot that highlights selecting your Function app instance.":::
135+
:::image type="content" source="./media/import-function-app-as-api/keys-01.png" alt-text="Screenshot that shows a list of function app instances." lightbox="./media/import-function-app-as-api/keys-01.png":::
134136

135-
2. In the **Functions** section of the side navigation menu, select **App keys**.
137+
1. In the **Functions** section of the left pane, select **App keys**:
136138

137-
:::image type="content" source="./media/import-function-app-as-api/keys-02b.png" alt-text="Screenshot that highlights the Function Apps settings option.":::
139+
:::image type="content" source="./media/import-function-app-as-api/keys-02b.png" alt-text="Screenshot that shows App keys in the menu." lightbox="./media/import-function-app-as-api/keys-02b.png":::
138140

139-
3. Find the keys under the **Host keys** section.
141+
1. Find the keys in the **Host keys** section:
140142

141-
:::image type="content" source="./media/import-function-app-as-api/keys-03.png" alt-text="Screenshot that highlights the Host Keys section.":::
143+
:::image type="content" source="./media/import-function-app-as-api/keys-03.png" alt-text="Screenshot that shows the host keys." lightbox="./media/import-function-app-as-api/keys-03.png":::
142144

143-
### Access the named value in Azure API Management
145+
### Access the named value in API Management
144146

145-
Navigate to your Azure API Management instance and select **Named values** from the menu on the left. The Azure Function App key is stored there.
147+
Navigate to your API Management instance and select **APIs** > **Named values** in the left pane. The Azure function app key is stored there.
146148

147-
:::image type="content" source="./media/import-function-app-as-api/api-named-value.png" alt-text="Add from Function App":::
149+
:::image type="content" source="./media/import-function-app-as-api/api-named-value.png" alt-text="Screenshot that shows the location of the function app key." lightbox="./media/import-function-app-as-api/api-named-value.png":::
148150

149-
## <a name="test-in-azure-portal"></a> Test the new API in the Azure portal
151+
## Test the new API in the Azure portal
150152

151153
You can call operations directly from the Azure portal. Using the Azure portal is a convenient way to view and test the operations of an API.
152154

153-
:::image type="content" source="./media/import-function-app-as-api/test-api.png" alt-text="Screenshot that highlights the test procedure.":::
155+
:::image type="content" source="./media/import-function-app-as-api/test-api.png" alt-text="Screenshot that shows the steps for testing an API." lightbox="./media/import-function-app-as-api/test-api.png":::
154156

155157
1. Select the API that you created in the preceding section.
156158

157-
2. Select the **Test** tab.
159+
1. Select the **Test** tab.
158160

159-
3. Select the operation you want to test.
161+
1. Select the operation that you want to test.
160162

161163
* The page displays fields for query parameters and headers.
162-
* One of the headers is "Ocp-Apim-Subscription-Key", for the product subscription key associated with this API.
163-
* As creator of the API Management instance, you are an administrator already, so the key is filled in automatically.
164+
* One of the headers is `Ocp-Apim-Subscription-Key`. This header is for the product subscription key that's associated with the API.
165+
* If you created the API Management instance, you're an administrator, so the key is filled in automatically.
164166

165-
4. Select **Send**.
167+
1. Select **Send**.
166168

167-
* When the test succeeds, the back end responds with **200 OK** and some data.
169+
When the test succeeds, the backend responds with **200 OK** and some data.
168170

169171
[!INCLUDE [api-management-define-api-topics.md](../../includes/api-management-define-api-topics.md)]
-29.2 KB
Loading
2.31 KB
Loading
35 KB
Loading
-6.94 KB
Loading
5.19 KB
Loading

0 commit comments

Comments
 (0)