Applications Lifecycle Management (ALM) and SharePoint flows (deploy your flows to different sites)

Deploying flows using SharePoint connections is very time-consuming, complex, and error-prone; unless your flows connect with SharePoint by using the Sharepoint REST api and the action Send an HTTP Request to SharePoint action (not Guid based).

Using out of the box SharePoint actions makes the deployment too complicated because most of the Power Automate SharePoint actions are based on list Guids. And of course, list Guids are different in your Dev, Test, UAT, and production environments. (it is possible to use the same guids, but this requires calling the SharePoint REST API or Powershell).

I had to solve this issue with my customers but also with my own projects. The biggest project I’m currently working on is the Power Platform BPM Toolkit for SharePoint, which consists of 68 flows. With many flows calling child flows in order to achieve elevation of privilege and code reusability.

I’ve tried using Environment variables, and that worked. The problem with the usage of environment variables and SharePoint related flows is that you lose dynamics properties if you want to edit your flows afterward. Watch my video for more details.

So I suggest a procedure that take 15 minutes (depending on the number of SharePoint list your are using). This should only be done one time! And your deployments will become very fast and errorless.

Before this, it tool me 1.5 day to update the 68 flows of the BPM Toolkit before deploying them. Now this part takes 20 minutes.

One of the solutions packages of the BPM Toolkit is the BPM Toolkit – ALM solution package, and this is what we are going to use here.

Let’s see how it works:

Step1.Download the BPM Toolkit setup file .

To get this Power Platform solution package, you should download the whole BPM Toolkit zip file from here, Unzip the setup file. One of the internal zip file is the BPMToolkitALM.zip, this is the one you need.

Step 2. Update the Excel file provided with the BPM Toolkit

You need an Excel file with a table and 2 columns named : oldstring and newstring. The ALM tool will go through all you flows and replace the “oldstring” with the corresponding “newstring”. For instance, I already provide an Excel file with the Guids of the BPM Toolkit dev environment. I use the third column (Name) for another utility that generates lists and fill in the guid in the new string column of this excel document. I will get back to this in another blog post.

You can use the Excel document provided with the BPM Toolkit as a template and clean it up (remove all info, keep the existing columns and the table structure)

Step 3. Fill-in Old strings and New strings

Fill-in the “oldstring” column with the string that you want to replaced in the flows that you will deploy: like list guids, service account name, site urls,…

Typically “oldstring” contains your dev environment info and “newstring “the test info.

Step 4. Create Dev and Test SharePoint sites

Create a basic SharePoint site that will mimic our DEV environment, in my case the site url is https://doctorflow1.sharepoint.com/sites/BPMToolkitDev.

Create another SharePoint site that will play the role of the TEST site. In my case, the site URL is https://doctorflow1.sharepoint.com/sites/BPMToolkitTest.

Step 5.Create 2 custom lists : list1 and list2 in the DEV and the Test SharePoint sites

Step 6. Create a Solution in DEV

In your Power Platform Dev environment, create a solution with 2 flows : Flow1 and Flow2 adding an item respectively in List1 and List2. Export the solution in unmanaged mode.

Step 7. Create the TEST environment

Create another Power Platform environment that will play the role of the TEST environment

Step 8. Import the ALM Tool in TEST

From the BPMToolkitSetup.zip file you download in step1, extract the file BPMToolkitALM.zip from and import it in your new Power Platform Test environment. This package uses CDS/Dataverse, so you need a premium license for using it (it could be a trial license). During the import, you will be asked to create connections for the following connection references:

This image has an empty alt attribute; its file name is image-3.png

Step 9. Upload the Excel ALM document

Extract the Excel document provided with the BPM Toolkit Setup file and upload it to your SharePoint TEST site. Remove the existing entries.

Step 10. Update the Excel information

Go back to your SharePoint DEV site and copy each list Guid in the Excel document stored in the TEST SharePoint site. To find the list Guid, go to your SharePoint site, click “Settings” as illustrated below:

The list Guid will be visible in the Browser header:

Fill

Fill-in the Excel sheet as illustrated in the next picture and don’t forget to mention the SharePoint site url of both sites !!!

In my case, I have the following Excel data:

Step 11. Import your custom solution in TEST

Go to your Test Power Platform environment, and import the solution containing your 2 flows.

Step 12.Update the “BPM Toolkit – ALM – Search and Replace” flow with the Excel document location.

Edit the BPM Toolkit – ALM – Search and Replace flow and make sure this flow points to the Excel document in your document library (Change the site location, the Document library and the Table).

So you start from this:

…to something that looks like this (with your own references):

Step 13. Specify the flows to update in your “BPM Toolkit – ALM – Search and Replace” flow

Edit the Search and replace flow, and update the Pass1 flows action : replace the existing flow names with your own flows (case sensitivity is important here):

Step 14. Run the “BPM Toolkit – ALM – Search and Replace” flow

Run this flow and select the parameter pass1

if everything goes well, your flows in Test have been updated. Congratulations !

But…what if you have child flows

The BPM Toolkit has many “proxy” flows calling child flows. This can be an issue. Indeed you need to make sure that the child flows are updated and activated before their calling flow. This is why the sequence of the flows in the action “Pass1 flows” is very important : mention the child flows before their caller.

Also you need to make sure that the setting “Manage run-only permissions” is set to a specific account and should not be “Provided by run-only user” as illustrated in the next picture:

so don’t do this:

but this is fine for child flows:

Most of the time, when your custom packages are imported, the system does it automatically, but I’ve noticed that this sometimes fails .

My solution is to have 2 passes:

In pass1 the system will transform all flows defined in the action Pass 1 Flow. So run pass1. And manually update the manage run only settings of the flows that usually are not updated.

in pass2 the system will transform all flows defined in the action Pass 2 Flow.

So I hope that you enjoyed this tool. In another blog post I will illustrate how another tools dynamically re-creates my SharePoint lists and fill-in automatically the Excel file. Don’t hesitate to ping me if you have any issue with the tool.

One response to “Applications Lifecycle Management (ALM) and SharePoint flows (deploy your flows to different sites)

Leave a comment