Migrating Power Platform apps/flows with SharePoint connections between tenants

Power Apps

Adding a data connection to SharePoint from a Power App is very straight forward: create a SharePoint connection, select a site, and then select one or more lists to read/write data. When the lists are referenced in the Power App code or components it uses the display name of the list. The list fields will also be referenced using their display names.

This means that when moving a Power App between tenants the SharePoint references can be easily updated if the SharePoint lists are identical between the two tenants with little to no code changes.

To migrate a Power App between tenants:

  1. Ensure SharePoint list names and column names are identical between tenants.
  2. Export the Power App from tenant A.
  3. Import the Power App into tenant B.
  4. Edit the Power App and delete the existing SharePoint references (make sure you take note of all connections that will need to be replaced). At this point a lot or errors will start to show where there are any references to the SharePoint lists.
  5. Add a new data connection, select or create a SharePoint connection to the new site in tenant B, and select the relevant lists. At this point, the data connections list should match what was in tenant A, just pointing to the new lists in tenant B. You’ll also notice the reference errors may not have disappeared.
  6. Save and close the app, then reopen the app. This will rebuild any connections and schemas to the updated data sources, and if the lists are identical between the two tenants, all the error should be resolved.

Power Automate

Adding data connections to SharePoint from a Power Automate flow is also very easy through the UI. The references to SharePoint lists are stored using the list ID which is a GUID. This means when moving a Flow between tenants the sites and lists will need to be manually updated with the new URL and list, even if the list names are the same, as the list IDs won’t match.

To migrate a Power Automate flow between tenants:

  1. Export the flow from tenant A.
  2. Import the flow to tenant B.
  3. Edit the flow and for any SharePoint actions, replace the site URL and list name fields with the updated details from tenant B.

Sometimes migrating flows between tenants isn’t as straight forward. During the import Power Automate may try to validate the existing connection details to tenant A which may fail. To get around this we can modify the exported flow json config and replace the SharePoint references before importing.

To do this:

  1. After exporting the flow from tenant A, extract the downloaded zip package.
  2. In the zip navigate through the folders Microsoft.Flow > flows > {Flow_GUID}.
  3. Open the file definition.json. This file is the definition of all the flow’s actions.
  4. For any SharePoint actions there will be two parameters that you can change: dataset and table. The dataset parameter will be the SharePoint URL, the table parameter will be the list GUID.
  5. Replace the value of the dataset parameter with the SharePoint URL from tenant B.
  6. Find the GUID of the corresponding list in tenant B. You can find this by going to the “Site Libraries and Lists” admin page (_layouts/15/mcontent.aspx) and click on the list. The GUID will be in the URL (?List={B37880C7-EE2A-4215-9E07-7CD5CFAB942D}).
  7. Replace the value of the table parameter with the new list GUID from tenant B.
  8. Once all references have been updated, zip the flow files back up and import into tenant B.

This issue might also happen when migrating a Power App with flows attached. If this happens, follow the same steps here before importing the Power App.