What do I need to do to start developing stateful or stateless workflows – Azure Logic Apps (Standard)? (Part II)

  • Sandro Pereira
  • Oct 28, 2020
  • 7 min read

In Part I of this blog series, I explained what you need to install to start developing stateful and stateless workflows using Azure Logic Apps (Preview). That article focused on setting up the required tools and prerequisites.

In this second part, I explain what you actually need to do to create your first Azure Logic Apps (Preview) workflow. Specifically, we will walk through one approach to create a Logic App (Preview) resource and then add stateful or stateless workflows using Visual Studio Code.

#1 Azure Monitoring Platform

📝 One-Minute Brief

Explains how to create your first Azure Logic Apps (Preview) resource and workflows using Visual Studio Code, covering the initial steps to build stateful or stateless workflows after completing the required setup.

Create a new Logic App (Preview) resource

To do that, you need:

  • Open VS Code and select the Azure icon.
Logic Apps (Preview)
  • In the Azure pane, under Azure: Logic Apps (Preview), select Sign in to Azure.
Logic Apps (Preview)
  • When the Visual Studio Code authentication page appears, sign in with your Azure account.
Logic Apps (Preview)
  • After you sign in, the Azure pane shows the subscriptions in your Azure account.
    • Any Logic Apps resources you may have already deployed/released will not be showing here. You can see any original Logic Apps resources you created using the original extension in the released extension’s Logic Apps section.
    • In the Logic App (Preview) section, you will only see the new Logic Apps (Preview) resource type within the functions runtime.
Logic Apps (Preview)

Note: You cannot create a Logic Apps (Preview) resource type directly from the Azure Portal. The only option at the moment is using Visual Studio Code (and probably scripting).

This is probably the best way, but if you don’t feel comfortable working in VS Code, the first thing you can do is:

  • From the Logic Apps (Preview) extension, right-click on your Subscription and select one of the two options:
    • Create Logic App in Azure…
    • Create Logic App in Azure… (Advance) – We will be using this one.
Logic Apps (Preview)
  • Centered at the top of the VS Code editor window, a wizard will appear asking to specify a globally unique name for the logic app, which is the name to use for the Logic App (Preview) resource.
    • Type My-First-Logic-App-Preview and press Enter.
Logic Apps (Preview)
  • The second step will ask you to select a hosting plan for your new logic app, either App Service Plan or Premium.
    • Select App Service Plan.
Logic Apps (Preview)
  • The next step asks you if you want to create a new App Service plan or select an existing plan.
    • Select Create new App Service Plan.
Logic Apps (Preview)
  • Enter the name of the new App Service Plan you are creating, or leave the default name
    • Type My-First-Logic-App-Preview-AS-Plan and press Enter.
Logic Apps (Preview)
  • And then select a pricing tier for the new App Service plan.
    • Select the S1 Standard plan (you can choose the F1 Free plan).
Logic Apps (Preview)
  • The next step asks you if you want to create a new resource group for new resources or select an existing resource group.
    • In this case, select Create new resource group
Logic Apps (Preview)
  • Enter the name of the new resource group you are creating, or leave the default name
    • Type My-First-Logic-App-Preview-RG and press Enter.
Logic Apps (Preview)
  • The next step asks you if you want to create a new storage account or select an existing storage account.
    • In this case, select Create new storage account
Logic Apps (Preview)
  • Enter the name of the new storage account you are creating, or leave the default name
    • Type myfirstlogicapppreviewsa and press Enter.
Logic Apps (Preview)
  • The next step asks you if you want to create a new Application Insights resource or select an existing Application Insights resource.
    • In this case, select Create new Application Insights resource
Logic Apps (Preview)
  • Enter the name of the new Application Insights resource you are creating, or leave the default name
    • Type My-First-Logic-App-Preview-AppIns and press Enter.
Logic Apps (Preview)
  • And finally, select a location for the new resources
    • In our case, West Europe.
Logic Apps (Preview)

After that, you will see on the bottom right of the VS Code Editor windows a status progress of the resources being created in Azure:

Logic Apps (Preview)

After it is finished, you will be able to see the resources in VS Code:

Logic Apps (Preview)

And the same through the Azure Portal:

Logic Apps (Preview)

Create a new stateful or stateless workflow

Creating workflows in Azure Logic Apps (Preview)

Now that we have created the Logic App (Preview) resource, we can start building workflows.
At this stage, we can choose between stateful and stateless workflows, depending on the scenario.

Stateful workflows

Stateful logic apps provide high resiliency when outages occur.
After services and systems recover, you can restore interrupted runs from the saved state and continue execution until completion. These workflows can run for up to one year.

Use stateful workflows when you need to store, review, or reference data from previous events.
These workflows persist inputs, outputs, and workflow state in external storage. As a result, you can review execution details and run history after each run finishes.

Stateless workflows

Use stateless logic apps when you don’t need to store or review data from previous executions.
These workflows keep inputs, outputs, and state only in memory, instead of saving data to external storage.

Because of this design, stateless workflows provide faster execution, lower latency, and higher throughput.
They usually run for no longer than five minutes and help reduce running costs because they don’t persist execution history.

However, stateless workflows do not automatically recover from outages.
If a run is interrupted, the caller must manually resubmit the request. These workflows also run synchronously only.

For easier troubleshooting, you can enable run history, although this option slightly impacts performance.

#1 Azure Monitoring Platform

To do that, we can:

  • Select the Logic App (Preview) resource we created previously, My-First-Logic-App-Preview, and then click on the Create Workflow… button.
Logic Apps (Preview)
  • Centered at the top of the VS Code editor window, a wizard will once again appear asking to select a template for your workflow. Select either Stateful Workflow or Stateless Workflow.
    • We will be using Stateful Workflow
Logic Apps (Preview)
  • Provide a workflow name for the workflow you are creating, or leave the default name
    • Type My-First-Stateful-Workflow and press Enter
Logic Apps (Preview)
  • This will create locally a workflow.json file that contains your logic app workflow’s underlying JSON definition.
    • Note: the Stateful Workflow is not yet created in Azure.
Logic Apps (Preview)

Since the full Logic Apps designer is supported in VS Code in this kind of resource, you may be thinking that now you can switch to Logic Apps designer… Unfortunately, using this creation strategy, you can’t! It will be exactly like the original Logic App extension. Only the code view is supported, and the Designer is read-only.

Does that mean that Logic Apps designer is not supported in VS Code? No, it is, but you need to use a different approach that we will address later in Part III.

You can modify the workflow logic as you want, for example, the bellow code:

Logic Apps (Preview)

Now, to actually create this resource in Azure (in the Logic App (Preview) resource group), you need to:

  • Select the Logic App (Preview) resource we created previously, My-First-Logic-App-Preview, and then click on the Deploy to Logic App… button.
Logic Apps (Preview)
  • If it asks if you are sure and if you want to overlap existing resources, select Yes.

The deployment will take some minutes to finish. After that, you will be able to see it on the Workflow list inside the Logic App (Preview) resource in VS Code:

Logic Apps (Preview)

Once again, the Designer is read-only.

But you can also find the stateful workflow in the Azure Portal, and from there, you will be able to use the new Logic App Designer.

Logic Apps (Preview)

Of course, all the changes you make in the Portal can be synchronized back to VS Code by selecting the Refresh button.

Logic Apps (Preview)

In the next blog post, we will explain a different and more powerful way for you to create your Logic Apps (Preview) projects and workflows. Stay tuned!

#1 Azure Monitoring Platform

Hope you find this helpful! If you liked the content or found it useful and would like to support me in writing more, consider buying (or helping to buy) a Star Wars Lego set for my son. 

Thanks for Buying me a coffe
Author: Sandro Pereira

Sandro Pereira lives in Portugal and works as a consultant at DevScope. In the past years, he has been working on implementing Integration scenarios both on-premises and cloud for various clients, each with different scenarios from a technical point of view, size, and criticality, using Microsoft Azure, Microsoft BizTalk Server and different technologies like AS2, EDI, RosettaNet, SAP, TIBCO etc. He is a regular blogger, international speaker, and technical reviewer of several BizTalk books all focused on Integration. He is also the author of the book “BizTalk Mapping Patterns & Best Practices”. He has been awarded MVP since 2011 for his contributions to the integration community.

1 thought on “What do I need to do to start developing stateful or stateless workflows – Azure Logic Apps (Standard)? (Part II)”

  1. Hi Sandro,
    Great Article!!
    Once again you proved that you are savior of so many integration Developer

    I have one question on the Logic Apps(Preview)
    we have the slot settings feature in the new logic apps(preview), for all configuration we can set slot setting enabled for our logic apps
    but api connections we dont have the slot settings, How does deployment on slots work if dont have the slot settings for the connections

Leave a Reply

Your email address will not be published. Required fields are marked *

The Ultimate Cloud
Management Platform for Azure

Supercharge your Azure Cost Saving

Learn More
Turbo360 Widget

Back to Top