web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Handling Duplicate Con...
Power Automate
Unanswered

Handling Duplicate Connection References when Copying Flows

(0) ShareShare
ReportReport
Posted on by 42

Problem: The connectionReferences array can sometimes have duplicate values. The Create Flow and Update Flow actions cannot handle these duplicates, even though they are needed for correct functioning.

Background: Our organization is building an automated system to backup, restore and move around flows to help with maintaining production and development environments. To copy a flow to somewhere else we pull the flow data, parse the connectionReferences data and map it to the new environment, and then use the Create New Flow / Update Flow actions as appropriate.

Detail: Below is an example of the connectionReferences component of an in operations flow.

 

 "connectionReferences": [
 {
 "connectionName": "befd187677324f96893626c4696fbce7",
 "displayName": "SQL Server",
 "id": "/providers/Microsoft.PowerApps/apis/shared_sql"
 },
 {
 "connectionName": "befd187677324f96893626c4696fbce7",
 "displayName": "SQL Server",
 "id": "/providers/Microsoft.PowerApps/apis/shared_sql"
 }
 ]

 

We can see that it is duplicated. If this array (appropriately parsed) is fed into a New Flow / Update Flow action, it will throw an error complaining of the duplication. (see below)

Screenshot_7.png

 

Can not add property shared_sql to Newtonsoft.Json.Linq.JObject. Property with the same name already exists on object.
 at Newtonsoft.Json.Linq.JObject.ValidateToken(JToken o, JToken existing)
 at Newtonsoft.Json.Linq.JContainer.InsertItem(Int32 index, JToken item, Boolean skipParentCheck)
 at Newtonsoft.Json.Linq.JContainer.AddInternal(Int32 index, Object content, Boolean skipParentCheck)

 

If the duplication is removed, some of the actions in the flow will be missing their associated connection.

In this example, examining the flow code, it can be seen that Power Automate is maintaining two separate connection objects - shared_sql_1 and shared_sql. See the installedConnectionReferences property below.

 

 "installedConnectionReferences": {
 "shared_sql": {
 "connectionName": "befd187677324f96893626c4696fbce7",
 "source": "Embedded",
 "id": "/providers/Microsoft.PowerApps/apis/shared_sql",
 ....blah blah blah....
 },
 "shared_sql_1": {
 "connectionName": "befd187677324f96893626c4696fbce7",
 "source": "Embedded",
 "id": "/providers/Microsoft.PowerApps/apis/shared_sql",
 ....blah blah blah....
 }
 }

 

If this was a one off, it wouldn't be a problem. However there are large numbers of flows in our organisation which can have these duplicates.

Without a solution there is no reliable way to copy, move, update, backup, or restore flows in an automated fashion.

Categories:
I have the same question (0)
  • Ana Almeida Profile Picture
    on at

    Hello, 

    I believe the best way to avoid this issue is start using a new feature called solution-aware flow, the ideia is to move the flows inside a solution and not just the Flow definition. 

     

    Please let me know if I was able to unblock you. 

    Ana Almeida | Power Platform Support Engineer

     

  • Cazzym Profile Picture
    42 on at

    @analmei - The issue with using solutions is we lose the granularity of being able to move a single flow at a time, without impacting on other flows. Not all features in flow such as manual triggers work the same in solutions either.

     

    If there is a way to export only a subset of flows from a solution into another solution while keeping the existing flows that might be of help, but previously we judged solutions an inpractical solution to our needs.

  • Verified answer
    Ana Almeida Profile Picture
    on at

    Hello, 

     

    The connection references are a separate component and should be used in the context of solutions at the moment. If you don't use solutions the behavior can be unexpected.

    In the case you want to export a subset of flows, you can create a solution just for them.

    It is important to mention, the Connection References is a Preview, if there is specific scenario in which this doesn't serve the purpose then it is best to open a case and describe the situation.

     

    To know more, how to work with solutions with using Microsoft Power Platform: https://docs.microsoft.com/en-us/power-platform/alm/

     

    Ana Almeida | Power Platform Support Engineer

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard