Tutorial: Create approval-based workflows using Azure Logic Apps

Applies to: Azure Logic Apps (Consumption)

This tutorial shows how to build an example workflow that automates an approval-based task by using Azure Logic Apps. This example specifically creates a Consumption logic app workflow that processes subscription requests for a mailing list that's managed by MailChimp.

The workflow starts with monitoring an email account for requests, sends received requests for approval, checks whether or not the request gets approval, adds approved members to the mailing list, and confirms whether or not new members get added to the list.

When you finish, your workflow looks like the following high level example:

Screenshot shows example Consumption high-level workflow.

Tip

To learn more, you can ask Azure Copilot these questions:

  • What's Azure Logic Apps?
  • What's a Consumption logic app workflow?

To find Azure Copilot, on the Azure portal toolbar, select Copilot.

You can create a similar workflow with a Standard logic app resource where some connector operations, such as Azure Blob Storage, are also available as built-in, service provider-based operations. However, the user experience and tutorial steps vary slightly from the Consumption version.

Prerequisites

Create a Consumption logic app resource

  1. In the Azure portal, sign in with your Azure account.

  2. In the Azure portal search box, enter logic app, and select Logic apps.

    Screenshot shows Azure portal search box with logic app entered and selected option for Logic apps.

  3. On the Logic apps page toolbar, select Add.

    The Create Logic App page appears and shows the following options:

    Plan Description
    Consumption Creates a logic app resource that supports only one workflow that runs in multitenant Azure Logic Apps and uses the Consumption model for billing.
    Standard Creates a logic app resource that supports multiple workflows. You have the following options:

    - Workflow Service Plan: Workflows run in single-tenant Azure Logic Apps and use the Standard model for billing.

    - App Service Environment V3: Workflows run in single-tenant Azure Logic Apps and use an App Service Environment plan for billing.

    - Hybrid (Preview): Workflows run on premises and in multiple clouds using Kubernetes Event-driven Autoscaling (KEDA). For more information, see Create Standard workflows for hybrid deployment.
  4. On the Create Logic App page, select Consumption (Multi-tenant).

  5. On the Basics tab, provide the following information about your logic app resource:

    Property Required Value Description
    Subscription Yes <Azure-subscription-name> Your Azure subscription name.

    This example uses Pay-As-You-Go.
    Resource Group Yes <Azure-resource-group-name> The Azure resource group where you create your logic app and related resources. This name must be unique across regions and can contain only letters, numbers, hyphens (-), underscores (_), parentheses (()), and periods (.).

    This example creates a resource group named LA-MailingList-RG.
    Logic App name Yes <logic-app-resource-name> Your logic app resource name, which must be unique across regions and can contain only letters, numbers, hyphens (-), underscores (_), parentheses (()), and periods (.).

    This example creates a logic app resource named LA-MailingList.
    Region Yes <Azure-region> The Azure datacenter region for your app.

    This example uses West US.
    Enable log analytics Yes No Change this option only when you want to enable diagnostic logging. For this tutorial, keep the default selection.

    Note: This option is available only with Consumption logic apps.

    Note

    Availability zones are automatically enabled for new and existing Consumption logic app workflows in Azure regions that support availability zones. For more information, see Reliability in Azure Functions and Protect logic apps from region failures with zone redundancy and availability zones.

    After you finish, your settings look similar to the following example:

    Screenshot shows Azure portal and creation page for multitenant Consumption logic app and details.

  6. When you finish, select Review + create. After Azure validates the information about your logic app resource, select Create.

  7. After Azure deploys your logic app resource, select Go to resource. Or, find and select your logic app resource by using the Azure search box.

Add a trigger to check emails

The following steps add a trigger that waits for incoming emails that have subscription requests.

  1. On the logic app menu, under Development Tools, select Logic app designer.

  2. On the workflow designer, follow these general steps to add the Office 365 Outlook trigger named When a new email arrives.

    The Office 365 Outlook connector 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.

  3. Sign in to your email account, which creates a connection between your workflow and your email account.

  4. In the trigger information box, from the Advanced parameters list, add the following parameters, if they don't appear, and provide the following information:

    Parameter Value Description
    Importance Any Specifies the importance level of the email that you want.
    Folder Inbox The email folder to check.
    Subject Filter subscribe-test-members-ML Specifies the text to find in the email subject and filters emails based on the subject line.

    Note

    When you select inside some edit boxes, the options for the dynamic content list (lightning icon) and expression editor (function icon) appear, which you can ignore for now.

    For more information about this trigger's properties, see the Office 365 Outlook connector reference or the Outlook.com connector reference.

    When you finish, the trigger looks similar to the following example:

    Screenshot shows Consumption workflow with trigger named When a new email arrives.

  5. Save your workflow. On the designer toolbar, select Save.

Your workflow is now live but doesn't do anything other check your emails. Next, add an action that responds when the trigger fires.

Add an action to send approval email

The following steps add an action that sends an email to approve or reject the request.

  1. On the designer, under the trigger named When a new email arrives, follow these general steps to add the Office 365 Outlook action named Send approval email.

  2. For the Send approval email action, provide the following information:

    Property Required Value Description
    To Yes <approver-email-address> The approver's email address. For testing, use your own address.
    Subject No <email-subject> A descriptive email subject.

    This example uses Approve member request for test-members-ML.

    For more information about these properties, see the Office 365 Outlook connector reference or the Outlook.com connector reference.

    When you finish, the Send approval email action looks like the following example:

    Screenshot shows information for action named Send approval email.

  3. Save your workflow.

Next, add a condition that checks the approver's selected response.

Add an action to check approval response

  1. On the designer, under the Send approval email action, follow these general steps to add the Control action named Condition.

  2. On the Condition action pane, rename the action with If request approved.

  3. Build a condition that checks whether the approver selected Approve.

    1. On the Parameters tab, in the first row under the AND list, select inside the left box, and then select the dynamic content list (lightning icon). From this list, in the Send approval email section, select the SelectedOption output.

      Screenshot shows condition action, second row with cursor in leftmost box, open dynamic content list, and SelectedOption selected.

    2. In the middle box, keep the operator named is equal to.

    3. In the right box, enter Approve.

    When you finish, the condition looks like the following example:

    Screenshot shows the finished condition for example approval workflow.

  4. Save your workflow.

Add an action to include member in MailChimp list

The following steps add an action that includes the approved member on your mailing list.

  1. In the condition's True block, follow these general steps to add the MailChimp action named Add member to list.

  2. Sign in and authorize access to your MailChimp account, which creates a connection between your workflow and your MailChimp account.

  3. In the Add member to list action, provide the following information:

    Parameter Required Value Description
    List Id Yes <mailing-list-name> The name for your MailChimp mailing list.

    This example uses test-members-ML.
    Status Yes <member-subscription-status> The new member's subscription status.

    This example selects subscribed.
    Email Address Yes <member-email-address> The new member's email address.

    1. Select inside the Email Address box, and then select the dynamic content list (lightning icon).

    From the dynamic content list, in the When a new email arrives section, select From, which is a trigger output.

    For more information about the Add member to list action properties, see the MailChimp connector reference.

    When you finish, the Add member to list action looks like the following example:

    Screenshot shows information for the MailChimp action named Add member to list.

  4. Save your workflow.

Add an action to check success or failure

The following steps add a condition to check whether the new member successfully joined your mailing list. Your workflow can then notify you whether this operation succeeded or failed.

  1. In the True block, under the Add member to list action, follow these general steps to add the Control action named Condition.

  2. Rename the condition with If add member succeeded.

  3. Build a condition that checks whether the approved member succeeds or fails in joining your mailing list.

    1. On the Parameters tab, in the first row under the AND list, select inside the left box, and then select the dynamic content list (lightning icon). From this list, in the Add member to list section, select the Status output.

    2. In the middle box, keep the operator named is equal to.

    3. In the right box, enter subscribed.

    When you finish, the condition looks like the following example:

    Screenshot shows finished condition to check added member.

Add an action to send success email

The following steps add an action to send success email when the workflow succeeds in adding the member to your mailing list.

  1. In the True block for the If add member succeeded condition, follow these general steps to add the Office 365 Outlook action named Send an email.

  2. Rename the Send an email action with Send email on success.

  3. In the Send email on success action, provide the following information:

    Parameter Required Value Description
    To Yes <recipient-email-address> The email recipient's email address. For testing purposes, use your own email address.
    Subject Yes <success-email-subject> The subject for the success email. For this example, follow these steps:

    1. Enter the following text with a trailing space: Success! Member added to test-members-ML:

    2. Select inside the Subject box, and select the dynamic content list option (lightning icon).

    3. From the Add member to list section, select Email Address.

    Note: If this output doesn't appear, next to the Add member to list section name, select See more.
    Body Yes <success-email-body> The body content for the success email. For this example, follow these steps:

    1. Enter the following text with a trailing space: Member opt-in status:

    2. Select inside the Body box, and select the dynamic content list option (lightning icon).

    3. From the Add member to list section, select Status.

    When you finish, the action looks like the following example:

    Screenshot shows information for action named Send email on success.

  4. Save your workflow.

Add an action to send failure email

The following steps add an action to send failure email when the workflow fails in adding the member to your mailing list.

  1. In the False block for the If add member succeeded condition, follow these general steps to add the Office 365 Outlook action named Send an email.

  2. Rename the Send an email action with Send email on failure.

  3. In the Send email on failure action, provide the following information:

    Parameter Required Value Description
    To Yes <recipient-email-address> The email recipient's email address. For testing purposes, use your own email address.
    Subject Yes <failure-email-subject> The subject for the failure email. For this example, follow these steps:

    1. Enter the following text with a trailing space: Failed, member not added to test-members-ML:

    2. Select inside the Subject box, and select the dynamic content list option (lightning icon).

    3. From the Add member to list section, select Email Address.

    Note: If this output doesn't appear, next to the Add member to list section name, select See more.
    Body Yes <failure-email-body> The body content for the failure email.

    For this example, enter the following text: Member might already exist. Check your MailChimp account.

    When you finish, the action looks like the following example:

    Screenshot shows information for action named Send email on failure.

  4. Save your workflow.

Your finished workflow looks similar to the following example:

Screenshot shows example finished workflow.

Test your workflow

  1. Send yourself an email request to join your mailing list. Wait for the request to appear in your inbox.

  2. To manually start your workflow, on the designer toolbar, select Run > Run.

    If your email has a subject that matches the trigger's subject filter, your workflow sends you email to approve the subscription request.

  3. In the approval email that you receive, select Approve.

  4. If the subscriber's email address doesn't exist on your mailing list, your workflow adds that person's email address and sends you an email like the following example:

    Screenshot shows example email for successful subscription.

  5. If your workflow can't add the subscriber, you get an email like the following example:

    Screenshot shows example email for failed subscription.

Tip

If you don't get any emails, check your email's junk folder. Otherwise, if you're unsure that your logic app ran correctly, see Troubleshoot your logic app.

Congratulations, you created and ran a logic app workflow that integrates information across Azure, Microsoft services, and other SaaS apps!

Clean up resources

Your workflow continues running until you disable or delete the logic app resource. When you no longer need this sample, delete the resource group that contains your logic app and related resources.

Your workflow continues running until you disable or delete the logic app resource. When you no longer need this sample, delete the resource group that contains your logic app and related resources.

  1. In the Azure portal search box, enter resource groups, and select Resource groups.

  2. From the Resource groups list, select the resource group for this tutorial.

  3. On the resource group menu, select Overview.

  4. On the Overview page toolbar, select Delete resource group.

  5. When the confirmation pane appears, enter the resource group name, and select Delete.

Next steps

In this tutorial, you created a logic app workflow that handles approvals for mailing list requests. Now, learn how to build a logic app workflow that processes and stores email attachments by integrating Azure services, such as Azure Storage and Azure Functions.