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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How to create a flow w...
Power Automate
Answered

How to create a flow with new connections

(1) ShareShare
ReportReport
Posted on by 19
Hi Power* geeks,
 
I have an issue when using the Power Automate Management/Create Flow action from a saved flow definition.
 
I have extracted a flow definition.json file and a connections.json file that I can use to re-create the flow.
The flow originated from another user. My user doesn't have the required connections.
 
So I am using Power Automate Management/Create connection to create the required connections. This works well.
Per connection, I get an output like here:
 
"body": {
    "name": "c128a352-d044-4627-aa66-c7e20f9a1056",    
    "id": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline/connections/c128a352-d044-4627-aa66-c7e20f9a1056",
    "type": "Microsoft.PowerApps/apis/connections",
    "properties": {
        "apiId": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline",
        "displayName": "{username}{token}",
        ...
}
 
 
(That´s a funny displayName...)
My flow has 2 connections. When I run the Create Flow action with a payload like this...
 
{
    "host": {
        "connectionReferenceName": "shared_flowmanagement",
        "operationId": "CreateFlow"
    },
    "parameters": {
        "Flow/properties/displayName": "MyFlow1",
        "Flow/properties/definition": {
...
        },
        "Flow/properties/state": "Stopped",
        "environmentName": "123ef266-bebb-4360-9131-2a93ee57a567",
        "Flow/properties/connectionReferences": [
            {
                "connectionName": "c128a352-d044-4cde-aa66-c7e20f9a1056",
                "id": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline"
            },
            {
                "connectionName": "d12c2927-2029-5abc-9a49-bc5772f6be34",
                "id": "/providers/Microsoft.PowerApps/apis/shared_office365"
            }
        ]
    },
    "retryPolicy": {
        "type": "None"
    }
}
 
...I get errors like:
- BadRequest, Action 'createflow' failed: Flow save failed with code 'WorkflowRunActionInputsInvalidProperty' and message 'The 'inputs' of workflow run action 'Send_an_email_(V2)' of type 'OpenApiConnection' should not have the property 'authentication'.'.
- BadRequest, Action 'createflow' failed: Flow save failed with code 'WorkflowRunActionInputsMissingProperty' and message 'The 'inputs' of workflow run action 'Create_a_task' of type 'OpenApiConnection' is not valid. Property 'host.connectionReferenceName' is missing.'.
- BadRequest, Action 'createflow' failed: Can not add property shared_sharepointonline to Newtonsoft.Json.Linq.JObject. 
- Internal Server Error, 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, Boolean copyAnnotations)
...depending on the situation.
 
[With Azure Logic Apps, this works properly. I can create a Bicep/ARM template and the connections are part of the flow. All good here.]
In Power Automate there seems to be a hidden logic, where the binding of a flow with a connection is done in the API logic (things like existing and numbered connections, like shared_sharepointonline, shared_sharepointonline-1, shared_sharepointonline-2, etc. authentication parameters, etc.)
It does not matter if the new connection is authenticated or not - the same results happen.
 
I can create new connections like this:
 
[
        {
            "connectionName": "a1238aac-79af-46be-877c-28caf11fafb1",
            "id": "/providers/Microsoft.PowerApps/apis/shared_planner"
        },
        { next connection ...}
]  
 
 
or like this:
 
[
            {
                "connectionName": "b12397d2-71e3-4fd7-b4a8-f93c7144bfe4",
                "id": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline",
                "apidefinitionname": "shared_sharepointonline",
                "displayName": "SharePoint",
                "connectionReferenceLogicalName": "new_sharedsharepointonline_61f8f",
                "source": "Embedded"
            },
            { next connection ...}
]    
 
I fully understand that the creation of the flow connectors must match with the existing connections.
However, as far as I experienced, the mapping seems to be a mystery since the API does not allow me to specify my new connection and replace these values in my flow definition.
As mentioned above, a new connection only has an id like c128a352-d044-4627-aa66-c7e20f9a1056 and this does not match with e.g. "shared_sharepointonline-1"...
There must be a mapping somewhere that I do not see.
 
To make it short:
Has anybody solved how I can create a new flow with the "Create Flow" action with new connections that I just created?
 
Thx for tips,
Toni
Categories:
I have the same question (3)
  • Suggested answer
    venturemavenwill Profile Picture
    1,193 Super User 2026 Season 1 on at
    Try to use the Power Platform CLI to export the solution and examine the JSON inside. 
     
    You should find Connection References like this:
     
    Connection Reference Settings JSON
     
    Try using it in the Create Flow action and see if it works. 
  • ToniP Profile Picture
    19 on at
    Hi venturemavenwill,
     
    thx!
    Unfortunately, the flow is not part of a solution - I just have the definition and existing connections (from another user) as text.
    The desired outcome is to have a flow that does the work for any user.
     
    However, this information is exactly what I would need when creating the connections and the flow - just, how could I get this and pass this to the create flow action in the flow environment?
     
    Thx, Toni
  • Verified answer
    venturemavenwill Profile Picture
    1,193 Super User 2026 Season 1 on at
    @ToniP the only other workaround I can think of is using the "Get a Flow as Admin" action. This allows you to retrieve the definition of a flow. 
     
    So the workflow then becomes - create a "template flow" that uses the connectors you want to use, in your main flow get the flow definition of the "template flow" using the "Get a Flow as Admin" action. You can then parse the JSON and get the connection information you need for the "Create Flow" action. 
  • ToniP Profile Picture
    19 on at
    Hi venturemavenwill,
     
    thx for your tips. Well, the original flow data is coming from the "Get Flow as Admin" action.
    This flow data is stored in a database (definition+connections of the original flow and the user connections).

     
    In my case the original flow no longer exists. That´s why they cannot be shared and I need a workaround to recreate the flow.
    The task is to create a new flow out of the definition and connections, but with new connections for another user in an automated process.
     
    So creating a new connection is one thing, but I´m still looking for the "mapping" between connection id´s (which I have) and how the Power Platform manages the user´s connections and connection names (what you pointed out using the solution+CLI). 
    I can get the user´s existing connections, but this does not reveal the connection name used in the flow (e.g. shared_sharepointonline-1).
    If I would get this connection names data, I could replace the host connection in the definition, and create the flow.
    This is my key point to automate the process.
     
    thx, Toni
     
  • Verified answer
    venturemavenwill Profile Picture
    1,193 Super User 2026 Season 1 on at
    @ToniP if you are using the Get a Flow as Admin step, then this parameter should be available to you

     
    Once you parse it, use the select action to get the Connection Name and ID
     
     
    This should be all you need to map the connections to the flow. 
  • trice602 Profile Picture
    16,071 Super User 2026 Season 1 on at
    I've marked this answer as helpful because it also answers my question.
     
    Always glad to help!  Tom 💯💯💯💯💯

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 605

#2
Valantis Profile Picture

Valantis 340

#3
11manish Profile Picture

11manish 284

Last 30 days Overall leaderboard