Blog Post

Azure Integration Services Blog
2 MIN READ

Backup Logic App Standard workflow definitions via Azure Function

Drac_Zhang's avatar
Drac_Zhang
Icon for Microsoft rankMicrosoft
Jul 08, 2022

Background

Recently we don't have version control in Logic App Standard which is a frequently used feature in Logic App Consumption, and it is difficult for us or customers to revert to a previous workflow version in Logic App Standard.

So this blog is to introduce the mechanism and provide sample Azure Function code to make it easier backup workflows regularly.

 

Mechanism

As we all know, in Logic App Standard, we will save all the workflow definitions in Storage Table and will maintain all the previous versions for 90 days.

For each single Logic App Standard, we will create a main table with the name "flow{15 characters ID}flows".

The content of the table looks like following:

 

As per the screenshot, we can see that this table contains all the information which we need for backup Logic App workflow (ChangedTime, DefinitionCompressed, FlowName).

 

Now, the only thing we need to resolve is how to map the Logic App Standard name to the table name (for example, in my test environment the Logic App Name is "DracLogicAppStandard" which to need to be mapped as "flowa46c97f5fe49965flows").

 

Firstly, I was just check whether the length of ID is 15 to determine whether this is the Logic App Standard table, but then I realized that we could combine multiple Logic App Standard to the same Storage Account, so they will have same ID length and cannot differentiate them.

 

After investigating of the VS Code local environment, there's a method called "MurmurHash64" in Microsoft.WindowsAzure.ResourceStack.dll (if you have VS Code development environment, you can find this DLL in %userprofile%\.azure-functions-core-tools\Functions\ExtensionBundles\Microsoft.Azure.Functions.ExtensionBundle.Workflows\<version>\bin) can help us to do the map.

 

The whole process is following:

  1. Convert Logic App Standard name to lower case and convert to byte[]
  2. Get hash value with the algorithm MurmurHash64 and convert back to string
  3. Substring the length to 15 characters
  4. append "flow" at begin and "flows" at end

As per the investigation, I also developed an Azure Function which can automate the backup: Drac-Zhang/LAAutoBackup (github.com)

Updated Jul 08, 2022
Version 1.0
  • Was_Dev's avatar
    Was_Dev
    Copper Contributor

    any idea what is the text in bold represent here?

    flow<logicappname>9ac589e9589ba25runs

     

    I need to distinguish my workflow(s) within the same logic apps.

  • AlexFilipovici's avatar
    AlexFilipovici
    Copper Contributor

    Is it possible to extract the flow's definition code from the Storage Tables?