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
+
26
+
* You can create a function directly from inside a Consumption logic app workflow, but from not a Standard logic app workflow. However, you can create functions in other ways. For more information, see [Create functions from inside logic app workflows](#create-function-designer).
27
+
28
+
* 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).
25
29
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).
30
+
*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
31
28
32
## Prerequisites
29
33
30
34
* 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
35
32
36
* 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
37
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.
38
+
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
39
36
40
* When you work with logic app resources, the same requirements apply to both function apps and functions, existing or new:
37
41
@@ -47,9 +51,7 @@ This article shows how to call an Azure function from a logic app workflow. To r
47
51
48
52
* 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
53
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).
54
+
* 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
55
54
56
<aname="function-swagger"></a>
55
57
@@ -100,16 +102,18 @@ Now that you've created your function in Azure, follow the steps to [add functio
100
102
101
103
<aname="create-function-designer"></a>
102
104
103
-
## Create functions from inside logic app workflows
You can create functions directly from your logic app's workflow by using the built-in Azure Functions action in the workflow designer, but you can use this method only for functions written in JavaScript. For other languages, you can create functions through the Azure Functions experience in the Azure portal. However, before you can create your function in Azure, you must already have a function app resource, which is a container for your functions. If you don't have a function app, create that function app first. For more information, review [Create your first function in the Azure portal](../azure-functions/functions-get-started.md).
107
+
You can create functions directly from inside your Consumption workflow by using the built-in Azure Functions action in the workflow designer, but you can use this method only for functions written in JavaScript. For other languages, you can create functions through the Azure Functions experience in the Azure portal. However, before you can create your function in Azure, you must already have a function app resource, which is a container for your functions. If you don't have a function app, create that function app first. For more information, review [Create your first function in the Azure portal](../azure-functions/functions-get-started.md).
106
108
107
-
> [!NOTE]
108
-
> Currently, you can only create a function directly from a Consumption logic app workflow, not a Standard logic app workflow.
109
-
> However, you can create the function in other ways using the [Azure portal](../azure-functions/functions-create-function-app-portal.md),
110
-
> [Visual Studio](../azure-functions/functions-create-your-first-function-visual-studio.md), [Visual Studio Code](../azure-functions/create-first-function-vs-code-csharp.md),
111
-
> [Azure CLI](/cli/azure/functionapp/app), [Azure PowerShell](/powershell/module/az.functions), or [ARM template](/azure/templates/microsoft.web/sites/functions).
112
-
> You can then call that function from your Standard logic app workflow using the Azure Functions operation named **Call an Azure function**.
109
+
Standard workflows currently don't support this option for creating a function from within a workflow, but you can create the function in the following ways and then [call that function from your Standard logic app workflow using the Azure Functions operation named **Call an Azure function**](#add-function-logic-app).
1. In the [Azure portal](https://portal.azure.com), open your Consumption logic app workflow in the designer.
115
119
@@ -163,7 +167,7 @@ You can create functions directly from your logic app's workflow by using the bu
163
167
164
168
<aname="add-function-logic-app"></a>
165
169
166
-
## Add existing functions to logic app workflows
170
+
## Add existing functions to logic app workflows (Consumption + Standard workflows)
167
171
168
172
To call existing functions from your logic app workflow, you can add functions like any other action in the workflow designer.
169
173
@@ -173,7 +177,9 @@ To call existing functions from your logic app workflow, you can add functions l
173
177
174
178
1. Under the step where you want to add the function, select **New step**.
175
179
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:
180
+
1. Under the **Choose an operation** search box, select **All**. In the search box, enter **azure functions**.
181
+
182
+
1. From the actions list, select the action named **Choose an Azure function**, for example:
177
183
178
184

179
185
@@ -203,9 +209,9 @@ To call existing functions from your logic app workflow, you can add functions l
203
209
204
210
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
211
206
-
1. Under the **Choose an operation** search box, select **Built-in** if not selected.
212
+
1. Under the **Choose an operation** search box, select **Built-in**. In the **Choose an operation** search box, enter **azure function**.
207
213
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:
214
+
1. From the actions list, select the action named **Call an Azure function**, for example:
209
215
210
216

211
217
@@ -229,16 +235,20 @@ To call existing functions from your logic app workflow, you can add functions l
229
235
230
236
<aname="enable-authentication-functions"></a>
231
237
232
-
## Enable authentication for function calls
238
+
## Enable authentication for function calls (Consumption workflows only)
233
239
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.
240
+
Your Consumption workflow can authenticate function calls and 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.
241
+
242
+
> [!NOTE]
243
+
>
244
+
> 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
245
236
246
For more information, review the following documentation:
237
247
238
248
*[Authenticate access with managed identities](create-managed-service-identity.md)
239
249
*[Add authentication to outbound calls](logic-apps-securing-a-logic-app.md#add-authentication-outbound)
240
250
241
-
To set up your function app and function so they can use your logic app's managed identity, follow these high-level steps:
251
+
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
252
243
253
1.[Enable and set up your logic app's managed identity](create-managed-service-identity.md).
244
254
@@ -250,9 +260,9 @@ To set up your function app and function so they can use your logic app's manage
250
260
251
261
<aname="set-authentication-function-app"></a>
252
262
253
-
## Set up your function for anonymous authentication
263
+
###Set up your function for anonymous authentication (Consumption workflows only)
254
264
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.
265
+
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
266
257
267
1. In the [Azure portal](https://portal.azure.com), find and select your function app.
258
268
@@ -284,7 +294,7 @@ For your function to use your logic app's managed identity, you must set your fu
284
294
285
295
<aname="find-required-values"></a>
286
296
287
-
## Find the required values to set up Azure AD authentication
297
+
###Find the required values to set up Azure AD authentication (Consumption workflows only)
288
298
289
299
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
300
@@ -293,13 +303,9 @@ Before you can set up your function app to use Azure AD authentication, you need
293
303
294
304
<aname="find-object-id"></a>
295
305
296
-
### Find the object ID for your logic app's managed identity
297
-
298
-
Based on the whether you have a Consumption or Standard logic app resource, follow the respective steps:
299
-
300
-
#### [Consumption](#tab/consumption)
306
+
#### Find the object ID for your logic app's managed identity
301
307
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**.
308
+
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
309
304
310
***System assigned**
305
311
@@ -317,31 +323,9 @@ Based on the whether you have a Consumption or Standard logic app resource, foll
317
323
318
324

319
325
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
326
<aname="find-tenant-id"></a>
343
327
344
-
### Find the tenant ID for your Azure AD
328
+
####Find the tenant ID for your Azure AD
345
329
346
330
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
331
@@ -355,9 +339,9 @@ To find your Azure AD tenant ID, either run the PowerShell command named [**Get-
355
339
356
340
<aname="create-app-registration"></a>
357
341
358
-
## Create app registration for your function app
342
+
###Create app registration for your function app (Consumption workflows only)
359
343
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).
344
+
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
345
362
346
1. In the [Azure portal](https://portal.azure.com), open your function app.
0 commit comments