Skip to content

Commit 06df278

Browse files
committed
Clarity updates about managed identity support
1 parent f8a8e49 commit 06df278

File tree

1 file changed

+30
-50
lines changed

1 file changed

+30
-50
lines changed

articles/logic-apps/logic-apps-azure-functions.md

Lines changed: 30 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -5,33 +5,35 @@ services: logic-apps
55
ms.suite: integration
66
ms.reviewer: estfan, azla
77
ms.topic: how-to
8-
ms.date: 02/14/2022
8+
ms.date: 03/07/2023
99
ms.custom: devx-track-js
1010
---
1111

1212
# Create and run code from workflows in Azure Logic Apps using Azure Functions
1313

14-
[!INCLUDE [logic-apps-sku-consumption](../../includes/logic-apps-sku-consumption.md)]
14+
[!INCLUDE [logic-apps-sku-consumption-standard](../../includes/logic-apps-sku-consumption.md)]
1515

1616
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:
1717

1818
* Extend your logic app's behavior with functions in Node.js or C#.
1919
* Perform calculations in your logic app workflow.
2020
* Apply advanced formatting or compute fields in your logic app workflows.
2121

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
2525

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.
2729

2830
## Prerequisites
2931

3032
* 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).
3133

3234
* 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.
3335

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.
3537

3638
* When you work with logic app resources, the same requirements apply to both function apps and functions, existing or new:
3739

@@ -47,9 +49,7 @@ This article shows how to call an Azure function from a logic app workflow. To r
4749

4850
* 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).
4951

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**.
5353

5454
<a name="function-swagger"></a>
5555

@@ -173,7 +173,9 @@ To call existing functions from your logic app workflow, you can add functions l
173173

174174
1. Under the step where you want to add the function, select **New step**.
175175

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:
177179

178180
![Screenshot showing Azure portal for Consumption logic app workflow and designer with the search box to find Azure functions.](./media/logic-apps-azure-functions/find-azure-functions-action-consumption.png)
179181

@@ -203,9 +205,9 @@ To call existing functions from your logic app workflow, you can add functions l
203205

204206
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**.
205207

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**.
207209

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:
209211

210212
![Screenshot showing the Azure portal for Standard logic app workflow and the designer with the search box to find Azure functions.](./media/logic-apps-azure-functions/find-azure-functions-action-standard.png)
211213

@@ -229,16 +231,20 @@ To call existing functions from your logic app workflow, you can add functions l
229231

230232
<a name="enable-authentication-functions"></a>
231233

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.
233237

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.
235241
236242
For more information, review the following documentation:
237243

238244
* [Authenticate access with managed identities](create-managed-service-identity.md)
239245
* [Add authentication to outbound calls](logic-apps-securing-a-logic-app.md#add-authentication-outbound)
240246

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:
242248

243249
1. [Enable and set up your logic app's managed identity](create-managed-service-identity.md).
244250

@@ -250,9 +256,9 @@ To set up your function app and function so they can use your logic app's manage
250256

251257
<a name="set-authentication-function-app"></a>
252258

253-
## Set up your function for anonymous authentication
259+
### Set up your function for anonymous authentication (Consumption workflows only)
254260

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.
256262

257263
1. In the [Azure portal](https://portal.azure.com), find and select your function app.
258264

@@ -284,7 +290,7 @@ For your function to use your logic app's managed identity, you must set your fu
284290

285291
<a name="find-required-values"></a>
286292

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)
288294

289295
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.
290296

@@ -293,13 +299,9 @@ Before you can set up your function app to use Azure AD authentication, you need
293299

294300
<a name="find-object-id"></a>
295301

296-
### Find the object ID for your logic app's managed identity
302+
#### Find the object ID for your logic app's managed identity
297303

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**.
303305

304306
* **System assigned**
305307

@@ -317,31 +319,9 @@ Based on the whether you have a Consumption or Standard logic app resource, foll
317319

318320
![Screenshot showing the user-assigned identity's "Overview" pane with the object ID selected.](./media/logic-apps-azure-functions/user-identity-object-id.png)
319321

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-
![Screenshot showing the Standard logic app "Identity" pane with the "System assigned" tab selected.](./media/logic-apps-azure-functions/system-identity-standard.png)
329-
330-
* **User assigned**
331-
332-
1. For the user-assigned identity, select the identity to find the object ID, for example:
333-
334-
![Screenshot showing the Standard logic app "Identity" pane with the "User assigned" tab selected.](./media/logic-apps-azure-functions/user-identity-standard.png)
335-
336-
1. On the managed identity's **Overview** pane, you can find the identity's object ID, for example:
337-
338-
![Screenshot showing the user-assigned managed identity's "Overview" pane with the object ID selected.](./media/logic-apps-azure-functions/user-identity-object-id.png)
339-
340-
---
341-
342322
<a name="find-tenant-id"></a>
343323

344-
### Find the tenant ID for your Azure AD
324+
#### Find the tenant ID for your Azure AD
345325

346326
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:
347327

@@ -355,9 +335,9 @@ To find your Azure AD tenant ID, either run the PowerShell command named [**Get-
355335

356336
<a name="create-app-registration"></a>
357337

358-
## Create app registration for your function app
338+
### Create app registration for your function app (Consumption workflows only)
359339

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).
361341

362342
1. In the [Azure portal](https://portal.azure.com), open your function app.
363343

0 commit comments

Comments
 (0)