Muokkaa

Jaa


Edit and manage logic apps in Visual Studio Code

Applies to: Azure Logic Apps (Consumption + Standard)

This guide shows how to work with deployed logic apps in Visual Studio Code and how to perform tasks such as edit, disable, enable, and delete. If you have both extensions for Azure Logic Apps (Consumption) and Azure Logic Apps (Standard) installed in Visual Studio Code, you can view all the deployed logic apps in your Azure subscription and perform management tasks with some that vary based on the logic app type.

Prerequisites

  • An Azure account and subscription. If you don't have a subscription, sign up for a free Azure account.

  • Access to the internet so that you can download the required extension if necessary, connect from Visual Studio Code to your Azure account, and publish any changes that you make to your project.

  • Visual Studio Code with the following extensions, based on the logic app type that you want to manage. You can also have both extensions installed at the same time.

    • Azure Logic Apps (Standard) extension for Visual Studio Code
    • Azure Logic Apps (Consumption) extension for Visual Studio Code
  • For Standard logic app workflows, you need the Standard logic app project that you want to edit or manage in Visual Studio Code.

Connect to your Azure account

If you aren't already connected to your Azure account, follow these steps to connect:

  1. In Visual Studio Code, on the Activity Bar, select the Azure icon to open the Azure pane.

    Screenshot shows the Visual Studio Code Activity Bar and selected Azure icon.

  2. In the Azure pane, in the Logic Apps (Consumption) section, select Sign in to Azure.

  3. When the Visual Studio Code authentication page appears, sign in with your Azure account.

    After you sign in, the Logic Apps (Consumption) section shows the Azure subscriptions for your Azure account. If the expected subscriptions don't appear, or you want the pane to show only specific subscriptions, follow these steps:

    1. In the Logic Apps (Consumption) section, move your pointer over the section title until the Select Subscriptions button (filter icon) appears. Select the filter icon.

    2. When the subscriptions list appears, select the subscriptions that you want, and make sure that you select OK.

View deployed logic apps in Visual Studio Code

  1. In Visual Studio Code, connect to your Azure account, if you haven't already.

  2. On the Activity Bar, select the Azure icon to open the Azure pane.

  3. In the Logic Apps (Consumption) section, expand your Azure subscription.

    You can now view all the deployed Consumption logic apps in the selected subscription, for example:

    Screenshot shows Visual Studio Code with Resources section and deployed Consumption logic app resource.

  4. Find and expand the node for the deployed Consumption logic app that you want.

    At the logic app resource level, you can select the following tasks from the logic app node shortcut menu:

    Task Select
    Open workflow in the designer Open in Designer, which opens the workflow in read-only mode.
    Open workflow in the code view editor Open in Editor, which opens the workflow for editing. See Edit a workflow.
  5. Expand the node for the items described in the following table where you want to view more information, if any exists:

    Node Description
    Runs Workflow run history
    Triggers Workflow trigger information.

    - To open in the code view editor, open the shortcut menu for the trigger, and select Open in Editor.

    - To run the trigger, open the shortcut menu for the trigger, and select Run.
    Versions Logic app versions.

    - To open in the designer, open the shortcut menu for a specific version, and select Open in Designer, which opens in read-only mode.

    - To open in the code view editor, open the shortcut menu for a specific version, and select Open in Editor, which opens in read-only mode.

Add blank workflow to project (Standard logic app only)

While a Consumption logic app can have only one workflow, a Standard logic app can have multiple workflows. To add a new empty workflow to your project, follow these steps:

  1. In Visual Studio Code, open your Standard logic app project, if not already open.

  2. On the Activity Bar, select the files icon, which opens the Explorer window to show your project.

  3. On your project folder shortcut menu, and select Create workflow.

  4. Select the workflow template Stateful or Stateless

  5. Provide a name for your workflow.

A new workflow folder now appears in your project. This folder contains a workflow.json file for the workflow's underlying JSON definition.

Edit a workflow

In Visual Studio Code, you can edit a deployed Consumption workflow using only the code view editor. If you open a deployed Consumption workflow using the designer, the workflow opens in read-only mode. By comparison, you can edit a Standard workflow using the designer or code view editor only within the context of your Standard logic app project in the Explorer pane. If you open a deployed Standard workflow using the designer or code view editor from the Resources section in the Azure pane, the workflow opens in read-only mode.

To edit a deployed Consumption or Standard workflow using the designer, make those changes in the Azure portal instead.

Important

Before you change your workflow, you might want to stop or disable your workflow. Make sure that you understand how your changes affect your workflow's operation. When you're done, remember to restart or reenable your workflow. For considerations around stopping, disabling, restarting, or re-enabling workflows, see the following documentation:

  1. In Visual Studio Code, on the Activity Bar, select the Azure icon to open the Azure pane.

  2. In the Logic Apps (Consumption) section, expand your Azure subscription, and find your logic app.

  3. Open the logic app shortcut menu, and select Open in Editor.

    Visual Studio Code opens the code view editor for the workflow's underlying JSON definition file named <logic-app-name>.logicapp.json file. You can now edit the workflow's underlying JSON definition.

  4. After you make changes and try to save your workflow, a message appears to confirm that you want to upload your changes to the deployed workflow.

  5. To continue saving and publishing your changes, select Upload.

    Azure saves the original workflow as a previous version. Your updated workflow becomes the current workflow.

  6. If your workflow is disabled, remember to reenable your workflow.

Disable or enable a deployed logic app

Deployed Consumption and Standard logic apps have different ways to disable and enable their activity. For considerations around how these tasks affect each logic app resource type, see the following documentation:

  1. In Visual Studio Code, on the Activity Bar, select the Azure icon to open the Azure pane.

  2. In the Logic Apps (Consumption) section, expand your Azure subscription, and find your logic app.

  3. Open the logic app shortcut menu. Based on the current activity state, select Disable or Enable.

Post logic app stoppage

After you stop a logic app, workflow triggers won't fire the next time that their conditions are met. However, trigger states remember the points at where you stopped the logic app. When you restart a logic app, the trigger fires for all unprocessed items since the last workflow run.

To stop a trigger from firing on unprocessed items since the last workflow run, you must clear the trigger state before you restart a logic app by following these steps:

  1. In Visual Studio Code, open your Consumption logic app workflow, and edit any part of the workflow trigger.

  2. Save your changes. This step resets your trigger's current state.

  3. Restart your logic app.

Delete logic apps

Deployed Consumption and Standard logic apps have different ways to delete their resources. For considerations around how deleting affects each logic app resource type, see the following documentation:

  1. In Visual Studio Code, on the Activity Bar, select the Azure icon to open the Azure pane.

  2. In the Logic Apps (Consumption) section, expand your Azure subscription, and find your logic app.

  3. Open the logic app shortcut menu, and select Delete.

Promote previous versions (Consumption only)

To publish an earlier Consumption logic app version, you can promote that version over the current version. Your logic app must have at least two versions to make the promote option available.

  1. In Visual Studio Code, on the Activity Bar, select the Azure icon to open the Azure pane.

  2. In the Logic Apps (Consumption) section, expand your Azure subscription, and find your logic app.

  3. Expand your logic app, expand Versions, and find the earlier version to promote.

  4. On the version shortcut menu, select Promote.