How to Publish and Obtain an Existing WDL Workflow in Visual Studio Code

In this section, we will focus on the process of publishing your Workflow Definition Language (WDL) workflow from Visual Studio Code to Azure Logic Apps. Additionally, we’ll cover how to retrieve an existing workflow from Azure Logic Apps if you need to modify or troubleshoot a pre-existing WDL workflow.


Step 1: Publishing a WDL Workflow to Azure Logic Apps

Once you’ve created your WDL-based workflow in Visual Studio Code, you need to publish it to Azure Logic Apps to execute it in the cloud. Here’s how to do it:

  1. Open the Command Palette:
  • In Visual Studio Code, press Ctrl + Shift + P to open the Command Palette.
  1. Create Azure Logic App:
  • If you haven’t already created a Logic App in Azure, you can do so by selecting “Logic App: Create Logic App (Standard) project“.
  • Follow the prompts to create a new Logic App by selecting your Azure subscription and resource group.
  1. Right-Click Deployment:
  • Once your workflow is ready in workflow.json, right-click the folder containing your project files in the Visual Studio Code explorer.
  • Choose Deploy to Logic App.
  1. Select Resource Group and Logic App:
  • If you already have a Logic App created, Visual Studio Code will prompt you to select an existing resource group and Logic App where you want to deploy the workflow.
  • After selecting, the workflow is deployed and ready to be triggered in Azure.
  1. Monitoring the Deployment:
  • You can monitor the deployment process in the Output window in Visual Studio Code.
  • If the deployment is successful, your workflow will be published and ready for execution within Azure Logic Apps.

Step 2: Obtaining and Editing an Existing WDL Workflow

If you have an existing WDL workflow already deployed in Azure Logic Apps and need to retrieve it for editing or debugging, Visual Studio Code allows you to easily pull it down for local development.

Here’s how to retrieve an existing Logic App workflow:

  1. Connect Visual Studio Code to Azure:
  • Ensure you are signed in to your Azure account in Visual Studio Code by using the Azure Tools extension. You can sign in via the Azure sidebar.
  1. Open the Logic Apps Extension:
  • From the left-hand sidebar, click on the Azure icon.
  • Navigate to Logic Apps in your Azure subscription.
  1. Find Your Logic App:
  • Browse through the resource groups and subscriptions until you find the Logic App where your WDL workflow is deployed.
  1. Download the Logic App Definition:
  • Right-click on the Logic App and select Download Workflow Definition.
  • Visual Studio Code will download the current workflow.json definition of your Logic App, which you can now edit locally.
  1. Edit the Workflow:
  • Make changes to the workflow.json as needed.
  • After making your changes, you can deploy the updated workflow back to Azure Logic Apps by following the steps in Step 1.

Monitoring and Testing Published Workflows

After publishing your workflow, you can manage and monitor it directly from the Azure Portal or Visual Studio Code.

  1. Testing in the Azure Portal:
  • Open the Azure Portal and navigate to the Logic Apps resource where your workflow is deployed.
  • Under the Runs History section, you can view detailed logs for each execution, including whether the workflow succeeded or failed and where in the process it failed.
  1. Triggering Manually:
  • You can trigger the Logic App manually from both the Azure Portal or Visual Studio Code.
  • Right-click on the Logic App in Visual Studio Code and select Run Logic App to manually trigger it.
  1. Real-time Debugging:
  • If the workflow encounters any issues, you can view the error logs and details in the Azure Portal’s Monitoring section or Visual Studio Code’s Output window.

Expanded Command Comparison Table: Python vs WDL

Here’s the updated and expanded command comparison table:

Feature/CommandPythonWDL (Workflow Definition Language)
Conditionalsif condition: ... else:@greater, @equals expressions in Condition
Loopsfor item in list:Apply to each action
Variable Initializationvariable = valueInitialize/Set Variable actions
Functionsdef function():Group of actions; reusable in scope but not across workflows
API Callsrequests.get/post('url')HTTP action for GET/POST requests
Expressionsx + y, substring(), mathWDL Expressions (add, concat, substring)
Date/Time Handlingdatetime.now()utcNow(), addDays()
Flow Controlbreak, continue, returnConditions inside loops, Terminate action
SharePoint IntegrationUse SharePlum library for SharePointHTTP requests to SharePoint REST API for CRUD operations
Parallel Processingthreading or asyncio librariesParallel Branches action in Logic Apps
Error Handlingtry-except blockScope action with success/failure conditions
Loggingprint(), logging moduleWrite to log action
File Manipulationopen(), with open()Use File action to manipulate files in Logic Apps
Parallel BranchesMultithreading, multiprocessingParallel Branches action to handle parallel executions

Useful Links

Below are links to Microsoft’s official documentation, which can help you learn more about Workflow Definition Language (WDL) and deploying Logic Apps.


Conclusion

Using WDL in Visual Studio Code to create, publish, and manage workflows gives you a powerful environment for building scalable automations. In this guide, we covered how to develop and publish a workflow that reads from a SharePoint list and copies items based on a price condition.

Additionally, with the ability to retrieve existing workflows, you can easily manage and troubleshoot Logic Apps workflows directly from Visual Studio Code, allowing for more streamlined development and maintenance processes.

Edvaldo Guimrães Filho Avatar

Published by

Categories:

Leave a comment