Skip to content

Commit ca96c87

Browse files
Merge pull request #272231 from ecfan/patch-1
Fix steps for creating a function
2 parents defe9c1 + 7040871 commit ca96c87

File tree

1 file changed

+35
-60
lines changed

1 file changed

+35
-60
lines changed

articles/logic-apps/tutorial-process-email-attachments-workflow.md

Lines changed: 35 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
---
22
title: Tutorial - Create workflows with multiple Azure services
3-
description: This tutorial shows how to create automated workflows in Azure Logic Apps using Azure Storage and Azure Functions.
3+
description: Learn how to create automated workflows using Azure Logic Apps, Azure Functions, and Azure Storage.
44
services: logic-apps
55
ms.suite: integration
66
ms.reviewer: estfan, azla
77
ms.topic: tutorial
88
ms.custom: "mvc, devx-track-csharp"
9-
ms.date: 01/04/2024
9+
ms.date: 04/16/2024
1010
---
1111

1212
# Tutorial: Create workflows that process emails using Azure Logic Apps, Azure Functions, and Azure Storage
@@ -105,7 +105,7 @@ Now, connect Storage Explorer to your storage account so you can confirm that yo
105105
106106
1. In the **Select Azure Environment** window, select your Azure environment, and then select **Next**.
107107

108-
This example continues by selecting global, multi-tenant **Azure**.
108+
This example continues by selecting global, multitenant **Azure**.
109109

110110
1. In the browser window that appears, sign in with your Azure account.
111111

@@ -139,46 +139,38 @@ Next, create an [Azure function](../azure-functions/functions-overview.md) that
139139

140140
Now, use the code snippet provided by these steps to create an Azure function that removes HTML from each incoming email. That way, the email content is cleaner and easier to process. You can then call this function from your workflow.
141141

142-
1. Before you can create a function, [create a function app](../azure-functions/functions-create-function-app-portal.md) following these steps:
142+
1. Before you can create a function, [create a function app](../azure-functions/functions-create-function-app-portal.md) by following these steps:
143143

144-
1. On the **Basics** tab, provide the following information, and then select **Next: Hosting**:
144+
1. On the **Basics** tab, provide the following information:
145145

146146
| Property | Value | Description |
147147
|----------|-------|-------------|
148148
| **Subscription** | <*your-Azure-subscription-name*> | The same Azure subscription that you previously used |
149149
| **Resource Group** | **LA-Tutorial-RG** | The same Azure resource group that you previously used |
150150
| **Function App name** | <*function-app-name*> | Your function app's name, which must be globally unique across Azure. This example already uses **CleanTextFunctionApp**, so provide a different name, such as **MyCleanTextFunctionApp-<*your-name*>** |
151-
| **Publish** | Code | Publish code files |
151+
| **Do you want to deploy code or container image?** | Code | Publish code files. |
152152
| **Runtime stack** | <*preferred-language*> | Select a runtime that supports your favorite function programming language. In-portal editing is only available for JavaScript, PowerShell, TypeScript, and C# script. C# class library, Java, and Python functions must be [developed locally](../azure-functions/functions-develop-local.md#local-development-environments). For C# and F# functions, select **.NET**. |
153-
|**Version**| <*version-number*> | Select the version for your installed runtime. |
154-
|**Region**| <*Azure-region*> | The same region that you previously used. This example uses **West US**. |
155-
|**Operating system**| <*your-operating-system*> | An operating system is preselected for you based on your runtime stack selection, but you can select the operating system that supports your favorite function programming language. In-portal editing is only supported on Windows. This example selects **Windows**. |
156-
| [**Plan type**](../azure-functions/functions-scale.md) | **Consumption (Serverless)** | Select the hosting plan that defines how resources are allocated to your function app. In the default **Consumption** plan, resources are added dynamically as required by your functions. In this [serverless](https://azure.microsoft.com/overview/serverless-computing/) hosting, you pay only for the time your functions run. When you run in an App Service plan, you must manage the [scaling of your function app](../azure-functions/functions-scale.md). |
153+
| **Version** | <*version-number*> | Select the version for your installed runtime. |
154+
| **Region** | <*Azure-region*> | The same region that you previously used. This example uses **West US**. |
155+
| **Operating System** | <*your-operating-system*> | An operating system is preselected for you based on your runtime stack selection, but you can select the operating system that supports your favorite function programming language. In-portal editing is only supported on Windows. This example selects **Windows**. |
156+
| [**Hosting options and plans**](../azure-functions/functions-scale.md) | **Consumption (Serverless)** | Select the hosting plan that defines how resources are allocated to your function app. In the default **Consumption** plan, resources are added dynamically as required by your functions. In this [serverless](https://azure.microsoft.com/overview/serverless-computing/) hosting, you pay only for the time your functions run. When you run in an App Service plan, you must manage the [scaling of your function app](../azure-functions/functions-scale.md). |
157157

158-
1. On the **Hosting** tab, provide the following information, and then select **Review + create**.
158+
1. Select **Next: Storage**. On the **Storage** tab, provide the following information:
159159

160160
| Property | Value | Description |
161161
|----------|-------|-------------|
162162
| [**Storage account**](../storage/common/storage-account-create.md) | **cleantextfunctionstorageacct** | Create a storage account used by your function app. Storage account names must be between 3 and 24 characters in length and can contain only lowercase letters and numbers. <br><br>**Note:** This storage account contains your function apps and differs from your previously created storage account for email attachments. You can also use an existing account, which must meet the [storage account requirements](../azure-functions/storage-considerations.md#storage-account-requirements). |
163163

164-
Azure automatically opens your function app after creation and deployment.
164+
1. When you're done, select **Review + create**. Confirm your information, and select **Create**.
165165

166-
1. If your function app doesn't automatically open after deployment, in the Azure portal search box, find and select **Function App**. From the **Function App** list, select your function app.
166+
1. After Azure creates and deploys the function app resource, select **Go to resource**.
167167

168-
1. On the function app resource menu, under **Functions**, select **Functions**. On the **Functions** toolbar, select **Create**.
168+
1. Now [create your function locally](../azure-functions/functions-create-function-app-portal.md?pivots=programming-language-csharp#create-your-functions-locally) as function creation in the Azure portal is limited. Make sure to use the **HTTP trigger** template, provide the following information for your function, and use the included sample code, which removes HTML and returns the results to the caller:
169169

170-
1. On the **Create function** pane, select the **HTTP trigger** template, provide the following information, and select **Create**.
171-
172-
| Property | Value |
173-
|----------|-------|
174-
| **New Function** | **RemoveHTMLFunction** |
175-
| **Authorization level** | **Function** |
176-
177-
Azure creates a function using a language-specific template for an HTTP triggered function and then opens the function's **Overview** page.
178-
179-
1. On the function menu, under **Developer**, select **Code + Test**.
180-
181-
1. After the editor opens, replace the template code with the following sample code, which removes the HTML and returns results to the caller:
170+
| Property | Value |
171+
|----------|-------|
172+
| **Function name** | **RemoveHTMLFunction** |
173+
| **Authorization level** | **Function** |
182174

183175
```csharp
184176
#r "Newtonsoft.Json"
@@ -206,21 +198,17 @@ Now, use the code snippet provided by these steps to create an Azure function th
206198
}
207199
```
208200

209-
1. When you're done, on the toolbar, select **Save**.
210-
211-
1. To test your function, on the toolbar, select **Test/Run**.
212-
213-
1. In the pane that opens, on the **Input** tab, in the **Body** box, enter the following line, and select **Run**.
201+
1. To test your function, you can use the following sample input:
214202

215203
`{"name": "<p><p>Testing my function</br></p></p>"}`
216204

217-
The **Output** tab shows the function's result:
205+
Your function's output looks like the following result:
218206

219207
```json
220208
{"updatedBody":"{\"name\": \"Testing my function\"}"}
221209
```
222210

223-
After checking that your function works, create your logic app resource and workflow. Although this tutorial shows how to create a function that removes HTML from emails, Azure Logic Apps also provides an **HTML to Text** connector.
211+
After you confirm that your function works, create your logic app resource and workflow. Although this tutorial shows how to create a function that removes HTML from emails, Azure Logic Apps also provides an **HTML to Text** connector.
224212

225213
## Create your logic app workflow
226214

@@ -240,46 +228,37 @@ After checking that your function works, create your logic app resource and work
240228

241229
1. Confirm the information that you provided, and select **Create**. After Azure deploys your app, select **Go to resource**.
242230

243-
The designer opens and shows a page with an introduction video and templates for common logic app workflow patterns.
244-
245-
1. Under **Templates**, select **Blank Logic App**.
246-
247-
![Screenshot showing Azure portal, Consumption workflow designer, and blank logic app template selected.](./media/tutorial-process-email-attachments-workflow/choose-logic-app-template.png)
248-
249-
Next, add a [trigger](logic-apps-overview.md#logic-app-concepts) that listens for incoming emails that have attachments. Every workflow must start with a trigger, which fires when the trigger condition is met, for example, a specific event happens or when new data exists. For more information, see [Quickstart: Create an example Consumption logic app workflow in multi-tenant Azure Logic Apps](quickstart-create-example-consumption-workflow.md).
231+
1. On the logic app resource menu, select **Logic app designer** to open the workflow designer.
250232

251233
## Add a trigger to check incoming email
252234

253-
1. On the designer, under the search box, select **Standard**. In the search box, enter **office 365 when new email arrives**.
235+
Now, add a [trigger](logic-apps-overview.md#logic-app-concepts) that checks for incoming emails that have attachments. Every workflow must start with a trigger, which fires when the trigger condition is met, for example, a specific event happens or when new data exists. For more information, see [Quickstart: Create an example Consumption logic app workflow in multitenant Azure Logic Apps](quickstart-create-example-consumption-workflow.md).
254236

255-
This example uses the Office 365 Outlook connector, which requires that you sign in with a Microsoft work or school account. If you're using a personal Microsoft account, use the Outlook.com connector.
237+
This example uses the Office 365 Outlook connector, which requires that you sign in with a Microsoft work or school account. If you're using a personal Microsoft account, use the Outlook.com connector.
256238

257-
1. From the triggers list, select the trigger named **When a new email arrives** for your email provider.
239+
1. On the workflow designer, select **Add a trigger**.
258240

259-
![Screenshot showing Consumption workflow designer with email trigger for "When a new email arrives" selected.](./media/tutorial-process-email-attachments-workflow/add-trigger-when-email-arrives.png)
241+
1. After the **Add a trigger** pane opens, in the search box, enter **office 365 outlook**. From the trigger results list, under **Office 365 Outlook**, select **When a new email arrives (V3)**.
260242

261-
1. If you're asked for credentials, sign in to your email account so that your workflow can connect to your email account.
243+
1. If you're asked for credentials, sign in to your email account, which creates a connection between your workflow and your email account.
262244

263245
1. Now provide the trigger criteria for checking new email and running your workflow.
264246

265247
| Property | Value | Description |
266248
|----------|-------|-------------|
267-
| **Folder** | **Inbox** | The email folder to check |
249+
| **Importance** | **Any** | Specifies the importance level of the email that you want. |
268250
| **Only with Attachments** | **Yes** | Get only emails with attachments. <br><br>**Note:** The trigger doesn't remove any emails from your account, checking only new messages and processing only emails that match the subject filter. |
269251
| **Include Attachments** | **Yes** | Get the attachments as input for your workflow, rather than just check for attachments. |
252+
| **Folder** | **Inbox** | The email folder to check |
270253

271-
1. From the **Add new parameter** list, select **Subject Filter**.
254+
1. From the **Advanced parameters** list, select **Subject Filter**.
272255

273256
1. After the **Subject Filter** box appears in the action, specify the subject as described here:
274257

275258
| Property | Value | Description |
276259
|----------|-------|-------------|
277260
| **Subject Filter** | **Business Analyst 2 #423501** | The text to find in the email subject |
278261

279-
1. To hide the trigger's details for now, collapse the action by clicking inside the trigger's title bar.
280-
281-
![Screenshot that shows collapsed trigger to hide details.](./media/tutorial-process-email-attachments-workflow/collapse-trigger-shape.png)
282-
283262
1. Save your workflow. On the designer toolbar, select **Save**.
284263

285264
Your logic app workflow is now live but doesn't do anything other check your emails. Next, add a condition that specifies criteria to continue subsequent actions in the workflow.
@@ -288,19 +267,15 @@ Next, add a [trigger](logic-apps-overview.md#logic-app-concepts) that listens fo
288267

289268
Now add a condition that selects only emails that have attachments.
290269

291-
1. On the designer, under the trigger, select **New step**.
270+
1. Under the trigger, select the plus sign (**+**), and then select **Add an action**.
292271

293-
1. Under the **Choose an operation** search box, select **Built-in**. In the search box, enter **condition**.
272+
1. On the **Add an action** pane, in the search box, enter **condition**.
294273

295-
1. From the actions list, select the action named **Condition**.
274+
1. From the action results list, select the action named **Condition**.
296275

297276
1. Rename the condition using a better description.
298277

299-
1. On the condition's title bar, select the ellipses (**...**) button > **Rename**.
300-
301-
![Screenshot showing the Condition action with the ellipses button and Rename button selected.](./media/tutorial-process-email-attachments-workflow/condition-rename.png)
302-
303-
1. Replace the default name with the following description: **If email has attachments and key subject phrase**
278+
1. On the **Condition** information pane, replace the condition's default name with the following description: **If email has attachments and key subject phrase**
304279

305280
1. Create a condition that checks for emails that have attachments.
306281

@@ -415,7 +390,7 @@ Next, add an action that creates a blob in your storage container so you can sav
415390
| Property | Value | Description |
416391
|----------|-------|-------------|
417392
| **Connection name** | **AttachmentStorageConnection** | A descriptive name for the connection |
418-
| **Authentication type** | **Access Key** | The authenticate type to use for the connection |
393+
| **Authentication type** | **Access Key** | The authentication type to use for the connection |
419394
| **Azure Storage account name or endpoint** | <*storage-account-name*> | The name for your previously created storage account, which is **attachmentstorageacct** for this example |
420395
| **Azure Storage Account Access Key** | <*storage-account-access-key*> | The access key for your previously created storage account |
421396

0 commit comments

Comments
 (0)