Skip to content

Files

242 lines (136 loc) · 17.1 KB

quickstart-create-logic-apps-with-visual-studio.md

File metadata and controls

242 lines (136 loc) · 17.1 KB
title description services ms.suite ms.reviewer ms.topic ms.custom ms.date
Quickstart - Create integration workflows with multi-tenant Azure Logic Apps in Visual Studio
Create automated integration workflows with multi-tenant Azure Logic Apps and Visual Studio Code.
logic-apps
integration
logicappspm
quickstart
mvc, mode-ui
05/25/2021

Quickstart: Create automated integration workflows with multi-tenant Azure Logic Apps and Visual Studio

This quickstart shows how to design, develop, and deploy automated workflows that integrate apps, data, systems, and services across enterprises and organizations by using multi-tenant Azure Logic Apps and Visual Studio. Although you can perform these tasks in the Azure portal, Visual Studio lets you add your logic apps to source control, publish different versions, and create Azure Resource Manager templates for different deployment environments. For more information about multi-tenant versus single-tenant model, review Single-tenant versus multi-tenant and integration service environment.

If you're new to Azure Logic Apps and just want the basic concepts, try the quickstart for creating a logic app in the Azure portal. The Logic App Designer works similarly in both the Azure portal and Visual Studio.

In this quickstart, you create the same logic app with Visual Studio as the Azure portal quickstart. You can also learn to create an example app in Visual Studio Code, and create and manage logic apps via the Azure CLI.This logic app monitors a website's RSS feed and sends email for each new item in that feed. Your finished logic app looks like this high-level workflow:

Screenshot that shows the high-level workflow of a finished logic app.

Prerequisites

Set up Visual Studio for Azure Government

Visual Studio 2017

You can use the Azure Environment Selector Visual Studio extension, which you can download and install from the Visual Studio Marketplace.

Visual Studio 2019

To work with Azure Government subscriptions in Azure Logic Apps, you need to add a discovery endpoint for Azure Government Cloud to Visual Studio. However, before you sign in to Visual Studio with your Azure Government account, you need to rename the JSON file that's generated after you add the discovery endpoint by following these steps:

  1. Close Visual Studio.

  2. Find the generated JSON file named Azure U.S. Government-A3EC617673C6C70CC6B9472656832A26.Configuration at this location:

    %localappdata%\.IdentityService\AadConfigurations

  3. Rename the JSON file to AadProvider.Configuration.json.

  4. Restart Visual Studio.

  5. Continue with the steps to sign in with your Azure Government account.

To revert this setup, delete the JSON file at the following location, and restart Visual Studio:

%localappdata%\.IdentityService\AadConfigurations\AadProvider.Configuration.json

Create Azure resource group project

To get started, create an Azure Resource Group project. Learn more about Azure resource groups and resources.

  1. Start Visual Studio. Sign in with your Azure account.

  2. On the File menu, select New > Project. (Keyboard: Ctrl + Shift + N)

    On "File" menu, select "New" > "Project"

  3. Under Installed, select Visual C# or Visual Basic. Select Cloud > Azure Resource Group. Name your project, for example:

    Create Azure Resource Group project

    [!NOTE] Resource group names can contain only letters, numbers, periods (.), underscores (_), hyphens (-), and parentheses ((, )), but can't end with periods (.).

    If Cloud or Azure Resource Group doesn't appear, make sure you install the Azure SDK for Visual Studio.

    If you're using Visual Studio 2019, follow these steps:

    1. In the Create a new project box, select the Azure Resource Group project for Visual C# or Visual Basic. Select Next.

    2. Provide a name for the Azure resource group you want to use and other project information. Select Create.

  4. From the template list, select the Logic App template. Select OK.

    Select Logic App template

    After Visual Studio creates your project, Solution Explorer opens and shows your solution. In your solution, the LogicApp.json file not only stores your logic app definition but is also an Azure Resource Manager template that you can use for deployment.

    Solution Explorer shows new logic app solution and deployment file

Create blank logic app

When you have your Azure Resource Group project, create your logic app with the Blank Logic App template.

  1. In Solution Explorer, open the LogicApp.json file's shortcut menu. Select Open With Logic App Designer. (Keyboard: Ctrl + L)

    Open logic app .json file with Logic App Designer

    [!TIP] If you don't have this command in Visual Studio 2019, check that you have the latest updates for Visual Studio.

    Visual Studio prompts you for your Azure subscription and an Azure resource group for creating and deploying resources for your logic app and connections.

  2. For Subscription, select your Azure subscription. For Resource group, select Create New to create another Azure resource group.

    Select Azure subscription, resource group, and resource location

    Setting Example value Description
    User account Fabrikam
    sophia-owen@fabrikam.com
    The account that you used when you signed in to Visual Studio
    Subscription Pay-As-You-Go
    (sophia-owen@fabrikam.com)
    The name for your Azure subscription and associated account
    Resource Group MyLogicApp-RG
    (West US)
    The Azure resource group and location for storing and deploying your logic app's resources
    Location Same as Resource Group The location type and specific location for deploying your logic app. The location type is either an Azure region or an existing integration service environment (ISE).

    For this quickstart, keep the location type set to Region and the location set to Same as Resource Group.

    Note: After you create your resource group project, you can change the location type and the location, but different location type affects your logic app in various ways.

  3. The Logic Apps Designer opens a page that shows an introduction video and commonly used triggers. Scroll down past the video and triggers to Templates, and select Blank Logic App.

    Select "Blank Logic App"

Build logic app workflow

Next, add an RSS trigger that fires when a new feed item appears. Every logic app starts with a trigger, which fires when specific criteria is met. Each time the trigger fires, the Logic Apps engine creates a logic app instance that runs your workflow.

  1. In Logic App Designer, under the search box, select All. In the search box, enter "rss". From the triggers list, select this trigger: When a feed item is published

    Build your logic app by adding a trigger and actions

  2. After the trigger appears in the designer, finish building the logic app by following the workflow steps in the Azure portal quickstart, then return to this article. When you're done, your logic app looks like this example:

    Finished logic app

  3. Save your Visual Studio solution. (Keyboard: Ctrl + S)

Deploy logic app to Azure

Before you can run and test your logic app, deploy the app to Azure from Visual Studio.

  1. In Solution Explorer, on your project's shortcut menu, select Deploy > New. If prompted, sign in with your Azure account.

    Create logic app deployment

  2. For this deployment, keep the default Azure subscription, resource group, and other settings. Select Deploy.

    Deploy logic app to Azure resource group

  3. If the Edit Parameters box appears, provide a resource name for your logic app. Save your settings.

    Provide deployment name for logic app

    When deployment starts, your app's deployment status appears in the Visual Studio Output window. If the status doesn't appear, open the Show output from list, and select your Azure resource group.

    Deployment status output

    If your selected connectors need input from you, a PowerShell window opens in the background and prompts for any necessary passwords or secret keys. After you enter this information, deployment continues.

    PowerShell window

    After deployment finishes, your logic app is live in the Azure portal and runs on your specified schedule (every minute). If the trigger finds new feed items, the trigger fires, which creates a workflow instance that runs your logic app's actions. Your logic app sends email for each new item. Otherwise, if the trigger doesn't find new items, the trigger doesn't fire and "skips" instantiating the workflow. Your logic app waits until the next interval before checking.

    Here are sample emails that this logic app sends. If you don't get any emails, check your junk email folder.

    Outlook sends email for each new RSS item

Congratulations, you've successfully built and deployed your logic app with Visual Studio. To manage your logic app and review its run history, see Manage logic apps with Visual Studio.

Add new logic app

When you have an existing Azure Resource Group project, you can add a new blank logic app to that project by using the JSON Outline window.

  1. In Solution Explorer, open the <logic-app-name>.json file.

  2. From the View menu, select Other Windows > JSON Outline.

  3. To add a resource to the template file, select Add Resource at the top of the JSON Outline window. Or in the JSON Outline window, open the resources shortcut menu, and select Add New Resource.

    JSON Outline window

  4. In the Add Resource dialog box, in the search box, find logic app, and select Logic App. Name your logic app, and select Add.

    Add resource

Clean up resources

When you're done with your logic app, delete the resource group that contains your logic app and related resources.

  1. Sign in to the Azure portal with the same account used to create your logic app.

  2. On the Azure portal menu, select Resource groups, or search for and select Resource groups from any page. Select your logic app's resource group.

  3. On the Overview page, select Delete resource group. Enter the resource group name as confirmation, and select Delete.

    "Resource groups" > "Overview" > "Delete resource group"

  4. Delete the Visual Studio solution from your local computer.

Next steps

In this article, you built, deployed, and ran your logic app with Visual Studio. To learn about managing and performing advanced deployment for logic apps with Visual Studio, see these articles:

[!div class="nextstepaction"] Manage logic apps with Visual Studio