You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When you want to run code that performs a specific job in your logic app workflow, you can create a function by using [Azure Functions](../azure-functions/functions-overview.md). This service helps you create Node.js, C#, and F# functions so you don't have to build a complete app or infrastructure to run code. Azure Functions provides serverless computing in the cloud and is useful for performing certain tasks, for example:
17
17
18
18
* Extend your logic app's behavior with functions in Node.js or C#.
19
19
* Perform calculations in your logic app workflow.
20
20
* Apply advanced formatting or compute fields in your logic app workflows.
21
21
22
-
> [!NOTE]
23
-
> Azure Logic Apps doesn't support using Azure Functions with deployment slots enabled. Although this scenario might sometimes work,
24
-
> this behavior is unpredictable and might result in authorization problems when your workflow tries call the Azure function.
22
+
This how-to guide shows how to call an Azure function from a logic app workflow. To run code snippets without using Azure Functions, review [Add and run inline code](logic-apps-add-run-inline-code.md). To call and trigger a logic app workflow from inside a function, the workflow must start with a trigger that provides a callable endpoint. For example, you can start the workflow with the **HTTP**, **Request**, **Azure Queues**, or **Event Grid** trigger. Inside your function, send an HTTP POST request to the trigger's URL and include the payload you want that workflow to process. For more information, review [Call, trigger, or nest logic app workflows](logic-apps-http-endpoint.md).
23
+
24
+
## Limitations
25
25
26
-
This article shows how to call an Azure function from a logic app workflow. To run code snippets without using Azure Functions, review [Add and run inline code](logic-apps-add-run-inline-code.md). To call and trigger a logic app workflow from inside a function, the workflow must start with a trigger that provides a callable endpoint. For example, you can start the workflow with the **HTTP**, **Request**, **Azure Queues**, or **Event Grid** trigger. Inside your function, send an HTTP POST request to the trigger's URL and include the payload you want that workflow to process. For more information, review [Call, trigger, or nest logic app workflows](logic-apps-http-endpoint.md).
26
+
* Currently, only Consumption workflows support authenticating Azure function calls using a managed identity with Azure Active Directory (Azure AD) authentication. Standard workflows aren't currently supported in the section about [how to enable authentication for function calls](#enable-authentication-functions).
27
+
28
+
* Azure Logic Apps doesn't support using Azure Functions with deployment slots enabled. Although this scenario might sometimes work, this behavior is unpredictable and might result in authorization problems when your workflow tries call the Azure function.
27
29
28
30
## Prerequisites
29
31
30
32
* Azure account and subscription. If you don't have a subscription, [sign up for a free Azure account](https://azure.microsoft.com/free/?WT.mc_id=A261C142F).
31
33
32
34
* An Azure function app resource, which is a container for a function that you can create using Azure Functions, along with the function that you want to use.
33
35
34
-
If you don't have a function app, [create your function app first](../azure-functions/functions-get-started.md). You can then create your function either outside your logic app in the Azure portal or [from inside your logic app](#create-function-designer) in the workflow designer.
36
+
If you don't have a function app, [create your function app first](../azure-functions/functions-get-started.md). You can then create your function either outside your logic app workflow by using Azure Functions in the Azure portal or [from inside your logic app workflow](#create-function-designer) in the designer.
35
37
36
38
* When you work with logic app resources, the same requirements apply to both function apps and functions, existing or new:
37
39
@@ -47,9 +49,7 @@ This article shows how to call an Azure function from a logic app workflow. To r
47
49
48
50
* If you have an OpenAPI definition for your function, the workflow designer gives you a richer experience when your work with function parameters. Before your logic app workflow can find and access functions that have OpenAPI definitions, [set up your function app by following these later steps](#function-swagger).
49
51
50
-
* Either a [Consumption or Standard](logic-apps-overview.md#resource-environment-differences) logic app resource and workflow where you want to use the function.
51
-
52
-
Before you can add an action that runs a function in your workflow, the workflow must start with a trigger as the first step. If you're new to logic app workflows, review [What is Azure Logic Apps](logic-apps-overview.md) and [Quickstart: Create your first logic app workflow](quickstart-create-first-logic-app-workflow.md).
52
+
* To follow the example in this how-to guide, you'll need a [Consumption logic app resource](logic-apps-overview.md#resource-environment-differences) and workflow that has a trigger as the first step. Although you can use any trigger for your scenario, this example uses the Office 365 Outlook trigger named **When a new email arrives**.
53
53
54
54
<aname="function-swagger"></a>
55
55
@@ -173,7 +173,9 @@ To call existing functions from your logic app workflow, you can add functions l
173
173
174
174
1. Under the step where you want to add the function, select **New step**.
175
175
176
-
1. Under **Choose an action**, in the search box, enter `azure functions`. From the actions list, select the action named **Choose an Azure function**, for example:
176
+
1. Under the **Choose an operation** search box, select **All**. In the search box, enter **azure functions**.
177
+
178
+
1. From the actions list, select the action named **Choose an Azure function**, for example:
177
179
178
180

179
181
@@ -203,9 +205,9 @@ To call existing functions from your logic app workflow, you can add functions l
203
205
204
206
1. On the designer, either under the last step or between existing steps in your workflow, select the plus (**+**) sign for **Insert a new step**, and then select **Add an action**.
205
207
206
-
1. Under the **Choose an operation** search box, select **Built-in** if not selected.
208
+
1. Under the **Choose an operation** search box, select **Built-in**. In the **Choose an operation** search box, enter **azure function**.
207
209
208
-
1.In the **Choose an operation** search box, enter `azure function`. From the actions list, select the action named **Call an Azure function**, for example:
210
+
1. From the actions list, select the action named **Call an Azure function**, for example:
209
211
210
212

211
213
@@ -229,16 +231,20 @@ To call existing functions from your logic app workflow, you can add functions l
229
231
230
232
<aname="enable-authentication-functions"></a>
231
233
232
-
## Enable authentication for function calls
234
+
## Enable authentication for function calls (Consumption workflows only)
235
+
236
+
When calling an Azure function, your Consumption workflow can authenticate access to resources protected by Azure Active Directory (Azure AD) by using a [managed identity](../active-directory/managed-identities-azure-resources/overview.md) (formerly known as Managed Service Identity or MSI). This managed identity can authenticate access without having to sign in and provide credentials or secrets. Azure manages this identity for you and helps secure your credentials because you don't have to provide or rotate secrets. You can set up the system-assigned identity or a manually created, user-assigned identity at the logic app resource level. The function that's called from your workflow can use the same identity for authentication.
233
237
234
-
To authenticate access to resources protected by Azure Active Directory (Azure AD), your logic app can use a [managed identity](../active-directory/managed-identities-azure-resources/overview.md) (formerly known as Managed Service Identity or MSI). This managed identity can authenticate access without having to sign in and provide credentials or secrets. Azure manages this identity for you and helps secure your credentials because you don't have to provide or rotate secrets. You can set up the system-assigned identity or a manually created, user-assigned identity on your logic app. The function that's called from your workflow can use the same identity for authentication.
238
+
> [!NOTE]
239
+
>
240
+
> Currently, only Consumption workflows support authentication for Azure function calls using a managed identity and Azure Active Directory (Azure AD) authentication. Standard workflows currently don't include this support when using the Azure Functions connector.
235
241
236
242
For more information, review the following documentation:
237
243
238
244
*[Authenticate access with managed identities](create-managed-service-identity.md)
239
245
*[Add authentication to outbound calls](logic-apps-securing-a-logic-app.md#add-authentication-outbound)
240
246
241
-
To set up your function app and function so they can use your logic app's managed identity, follow these high-level steps:
247
+
To set up your function app and function so they can use your Consumption logic app's managed identity, follow these high-level steps:
242
248
243
249
1.[Enable and set up your logic app's managed identity](create-managed-service-identity.md).
244
250
@@ -250,9 +256,9 @@ To set up your function app and function so they can use your logic app's manage
250
256
251
257
<aname="set-authentication-function-app"></a>
252
258
253
-
## Set up your function for anonymous authentication
259
+
###Set up your function for anonymous authentication (Consumption workflows only)
254
260
255
-
For your function to use your logic app's managed identity, you must set your function's authentication level to anonymous. Otherwise, your logic app workflow throws a **BadRequest** error.
261
+
For your function to use your Consumption logic app's managed identity, you must set your function's authentication level to anonymous. Otherwise, your workflow throws a **BadRequest** error.
256
262
257
263
1. In the [Azure portal](https://portal.azure.com), find and select your function app.
258
264
@@ -284,7 +290,7 @@ For your function to use your logic app's managed identity, you must set your fu
284
290
285
291
<aname="find-required-values"></a>
286
292
287
-
## Find the required values to set up Azure AD authentication
293
+
###Find the required values to set up Azure AD authentication (Consumption workflows only)
288
294
289
295
Before you can set up your function app to use Azure AD authentication, you need to find and save the following values by following the steps in this section.
290
296
@@ -293,13 +299,9 @@ Before you can set up your function app to use Azure AD authentication, you need
293
299
294
300
<aname="find-object-id"></a>
295
301
296
-
### Find the object ID for your logic app's managed identity
302
+
####Find the object ID for your logic app's managed identity
297
303
298
-
Based on the whether you have a Consumption or Standard logic app resource, follow the respective steps:
299
-
300
-
#### [Consumption](#tab/consumption)
301
-
302
-
1. After your logic app has its managed identity enabled, on the logic app menu, under **Settings**, select **Identity**, and then select either **System assigned** or **User assigned**.
304
+
1. After your Consumption logic app has its managed identity enabled, on the logic app menu, under **Settings**, select **Identity**, and then select either **System assigned** or **User assigned**.
303
305
304
306
***System assigned**
305
307
@@ -317,31 +319,9 @@ Based on the whether you have a Consumption or Standard logic app resource, foll
317
319
318
320

319
321
320
-
#### [Standard](#tab/standard)
321
-
322
-
1. After your logic app has its managed identity enabled, on the logic app menu, under **Settings**, select **Identity**, and then select either **System assigned** or **User assigned**.
323
-
324
-
***System assigned**
325
-
326
-
For the system-assigned identity, copy the identity's object ID, for example:
327
-
328
-

329
-
330
-
***User assigned**
331
-
332
-
1. For the user-assigned identity, select the identity to find the object ID, for example:
333
-
334
-

335
-
336
-
1. On the managed identity's **Overview** pane, you can find the identity's object ID, for example:
337
-
338
-

339
-
340
-
---
341
-
342
322
<aname="find-tenant-id"></a>
343
323
344
-
### Find the tenant ID for your Azure AD
324
+
####Find the tenant ID for your Azure AD
345
325
346
326
To find your Azure AD tenant ID, either run the PowerShell command named [**Get-AzureAccount**](/powershell/module/servicemanagement/azure.service/get-azureaccount), or in the Azure portal, follow these steps:
347
327
@@ -355,9 +335,9 @@ To find your Azure AD tenant ID, either run the PowerShell command named [**Get-
355
335
356
336
<aname="create-app-registration"></a>
357
337
358
-
## Create app registration for your function app
338
+
###Create app registration for your function app (Consumption workflows only)
359
339
360
-
After you find the object ID for your logic app's managed identity and tenant ID for your Azure AD, you can set up your function app to use Azure AD authentication by creating an app registration. For more information, review [Configure your App Service or Azure Functions app to use Azure AD login](../app-service/configure-authentication-provider-aad.md#-step-2-enable-azure-active-directory-in-your-app-service-app).
340
+
After you find the object ID for your Consumption logic app's managed identity and tenant ID for your Azure AD, you can set up your function app to use Azure AD authentication by creating an app registration. For more information, review [Configure your App Service or Azure Functions app to use Azure AD login](../app-service/configure-authentication-provider-aad.md#-step-2-enable-azure-active-directory-in-your-app-service-app).
361
341
362
342
1. In the [Azure portal](https://portal.azure.com), open your function app.
0 commit comments