Backup Logic App Standard workflow definitions via Azure Function
Published Jul 08 2022 12:49 AM 1,919 Views
Microsoft

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:

Drac_Zhang_1-1657264256641.png

 

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)

2 Comments
Co-Authors
Version history
Last update:
‎Jul 08 2022 12:42 AM
Updated by: