Quickstart: Create and manage automated logic app workflows - Visual Studio Code

With Azure Logic Apps and Visual Studio Code, you can create and manage logic apps that help you automate tasks, workflows, and processes for integrating apps, data, systems, and services across organizations and enterprises. This quickstart shows how you can create and edit logic app workflow definitions by working with the workflow definition schema in JavaScript Object Notation (JSON) through a code-based experience. You can also work on existing logic apps already deployed to Azure in the cloud.

Although you can perform these same tasks in the Azure portal and in Visual Studio, you can get started faster in Visual Studio Code when you're already familiar with logic app definitions and want to work directly in code. For example, you can disable, enable, delete, and refresh already created logic apps. Also, you can work on logic apps and integration accounts from any development platform where Visual Studio Code runs, such as Linux, Windows, and Mac.

For this article, you can create the same logic app as in the quickstart for creating a logic app in the Azure portal, which focuses more on the basic concepts. In Visual Studio Code, the logic app looks like this example:

Finished logic app

Before you start, make sure you have these items:

Sign in to Azure

  1. Open Visual Studio Code. On the Visual Studio Code toolbar, select the Azure icon.

    Select Azure icon

  2. In the Azure window, under Logic Apps, select Sign in to Azure.

    Select "Sign in to Azure"

    You're now prompted to sign in by using the provided authentication code.

  3. Copy the authentication code, and then choose Copy & Open, which opens a new browser window.

    Sign-in prompt

  4. Enter your authentication code. When prompted, choose Continue.

    Enter code

  5. Select your Azure account. After you sign in, you can close your browser, and return to Visual Studio Code.

    In the Azure window, the Logic Apps pane and Integration Accounts pane now show the Azure subscriptions in your account.

    Select subscription

    If you don't see the subscriptions you expect, next to Logic Apps label, choose Select Subscriptions (filter icon). Find and select the subscriptions you want.

  6. To view any existing logic apps or integration accounts in your Azure subscription, expand your subscription.

    View logic apps and integration accounts

Create logic app

  1. If you haven't signed in to your Azure subscription from inside Visual Studio Code, follow the steps in this article to sign in now.

  2. From your subscription's context menu, select Create.

    Select "Create"

  3. From the list that shows Azure resource groups in your subscription, select an existing resource group or Create a new resource group.

    This example creates a new resource group:

    Create new resource group

  4. Provide a name for your Azure resource group, and then press ENTER.

    Name your resource group

  5. Select the datacenter location for where to save your logic app's metadata.

    Select location

  6. Provide a name for your logic app, and then press ENTER.

    Name your logic app

    Your new logic app now appears in the Azure window, under your Azure subscription. Now you can start creating your logic app's workflow definition.

  7. From your logic app's shortcut menu, select Open in Editor.

    Open logic app in editor

    Visual Studio Code opens a logic app workflow definition template (.logicapp.json file) so you can start creating your logic app's workflow.

    New logic app workflow definition

  8. In the logic app workflow definition template file, start building your logic app's workflow definition. For technical reference, see the Workflow Definition Language schema for Azure Logic Apps.

    Here is an example logic definition. Usually, JSON elements appear alphabetically within each section, but this sample shows these elements roughly in the order that the logic app's steps appear on the designer.

    {
       "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
       "contentVersion": "1.0.0.0",
       "parameters": {
          "$connections": {
             "defaultValue": {},
             "type": "Object"
          }
       },
       "triggers": {
          "When_a_feed_item_is_published": {
             "recurrence": {
                "frequency": "Minute",
                "interval": 1
             },
             "splitOn": "@triggerBody()?['value']",
             "type": "ApiConnection",
             "inputs": {
                "host": {
                   "connection": {
                      "name": "@parameters('$connections')['rss']['connectionId']"
                   }
                },
                "method": "get",
                "path": "/OnNewFeed",
                "queries": {
                   "feedUrl": "http://feeds.reuters.com/reuters/topNews"
                }
             }
          }
       },
       "actions": {
          "Send_an_email": {
             "runAfter": {},
             "type": "ApiConnection",
             "inputs": {
                "body": {
                   "Body": "Title: @{triggerBody()?['title']}\n\nDate published: @{triggerBody()?['publishDate']}\n\nLink: @{triggerBody()?['primaryLink']}",
                   "Subject": "New RSS item: @{triggerBody()?['title']}",
                   "To": "Sophie.Owen@contoso.com"
                },
                "host": {
                   "connection": {
                      "name": "@parameters('$connections')['outlook']['connectionId']"
                   }
                },
                "method": "post",
                "path": "/Mail"
             }
          }
       },
       "outputs": {}
    }   
    
  9. When you're done, save your logic app definition file. When Visual Studio Code prompts you to confirm uploading your logic app definition to your Azure subscription, choose Upload.

    Upload your new logic app

    After Visual Studio Code publishes your logic app to Azure, you can find your app now live and running in the Azure portal.

    Logic app published in Azure portal

Edit logic app

To work on an existing logic app that's already deployed in Azure, you can open that app's workflow definition file in Visual Studio Code.

  1. If you haven't signed in to your Azure subscription from inside Visual Studio Code, follow the steps in this article to sign in now.

  2. In the Azure window, under Logic Apps, expand your Azure subscription, and select the logic app you want.

  3. From your logic app's menu, select Open in Editor. Or, next to your logic app's name, choose the edit icon.

    Open editor for existing logic app

    Visual Studio Code opens the .logicapp.json file for your logic app's workflow definition.

    Opened logic app workflow definition

  4. Make your changes in your logic app's definition.

  5. When you're done, save your changes.

  6. When Visual Studio Code prompts you to update your logic app definition in your Azure subscription, choose Upload.

    Upload your edits

Get support