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
Copy file name to clipboardExpand all lines: articles/logic-apps/tutorial-process-email-attachments-workflow.md
+35-60Lines changed: 35 additions & 60 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,12 +1,12 @@
1
1
---
2
2
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.
4
4
services: logic-apps
5
5
ms.suite: integration
6
6
ms.reviewer: estfan, azla
7
7
ms.topic: tutorial
8
8
ms.custom: "mvc, devx-track-csharp"
9
-
ms.date: 01/04/2024
9
+
ms.date: 04/16/2024
10
10
---
11
11
12
12
# 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
105
105
106
106
1. In the **Select Azure Environment** window, select your Azure environment, and then select **Next**.
107
107
108
-
This example continues by selecting global, multi-tenant**Azure**.
108
+
This example continues by selecting global, multitenant**Azure**.
109
109
110
110
1. In the browser window that appears, sign in with your Azure account.
111
111
@@ -139,46 +139,38 @@ Next, create an [Azure function](../azure-functions/functions-overview.md) that
139
139
140
140
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.
141
141
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:
143
143
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:
145
145
146
146
| Property | Value | Description |
147
147
|----------|-------|-------------|
148
148
|**Subscription**| <*your-Azure-subscription-name*> | The same Azure subscription that you previously used |
149
149
|**Resource Group**|**LA-Tutorial-RG**| The same Azure resource group that you previously used |
150
150
|**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.|
152
152
|**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). |
157
157
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:
159
159
160
160
| Property | Value | Description |
161
161
|----------|-------|-------------|
162
162
|[**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). |
163
163
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**.
165
165
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**.
167
167
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:
169
169
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**|
182
174
183
175
```csharp
184
176
#r"Newtonsoft.Json"
@@ -206,21 +198,17 @@ Now, use the code snippet provided by these steps to create an Azure function th
206
198
}
207
199
```
208
200
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:
214
202
215
203
`{"name": "<p><p>Testing my function</br></p></p>"}`
216
204
217
-
The **Output** tab shows the function's result:
205
+
Your function's output looks like the following result:
218
206
219
207
```json
220
208
{"updatedBody":"{\"name\": \"Testing my function\"}"}
221
209
```
222
210
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.
224
212
225
213
## Create your logic app workflow
226
214
@@ -240,46 +228,37 @@ After checking that your function works, create your logic app resource and work
240
228
241
229
1. Confirm the information that you provided, and select **Create**. After Azure deploys your app, select **Go to resource**.
242
230
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**.
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.
250
232
251
233
## Add a trigger to check incoming email
252
234
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).
254
236
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.
256
238
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**.
258
240
259
-

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)**.
260
242
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.
262
244
263
245
1. Now provide the trigger criteria for checking new email and running your workflow.
264
246
265
247
| Property | Value | Description |
266
248
|----------|-------|-------------|
267
-
|**Folder**|**Inbox**|The email folder to check|
249
+
|**Importance**|**Any**|Specifies the importance level of the email that you want.|
268
250
|**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. |
269
251
|**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 |
270
253
271
-
1. From the **Add new parameter** list, select **Subject Filter**.
254
+
1. From the **Advanced parameters** list, select **Subject Filter**.
272
255
273
256
1. After the **Subject Filter** box appears in the action, specify the subject as described here:
274
257
275
258
| Property | Value | Description |
276
259
|----------|-------|-------------|
277
260
|**Subject Filter**|**Business Analyst 2 #423501**| The text to find in the email subject |
278
261
279
-
1. To hide the trigger's details for now, collapse the action by clicking inside the trigger's title bar.
280
-
281
-

282
-
283
262
1. Save your workflow. On the designer toolbar, select **Save**.
284
263
285
264
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
288
267
289
268
Now add a condition that selects only emails that have attachments.
290
269
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**.
292
271
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**.
294
273
295
-
1. From the actions list, select the action named **Condition**.
274
+
1. From the action results list, select the action named **Condition**.
296
275
297
276
1. Rename the condition using a better description.
298
277
299
-
1. On the condition's title bar, select the ellipses (**...**) button > **Rename**.
300
-
301
-

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**
304
279
305
280
1. Create a condition that checks for emails that have attachments.
306
281
@@ -415,7 +390,7 @@ Next, add an action that creates a blob in your storage container so you can sav
415
390
| Property | Value | Description |
416
391
|----------|-------|-------------|
417
392
|**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 |
419
394
|**Azure Storage account name or endpoint**| <*storage-account-name*> | The name for your previously created storage account, which is **attachmentstorageacct** for this example |
420
395
|**Azure Storage Account Access Key**| <*storage-account-access-key*> | The access key for your previously created storage account |
0 commit comments