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"
}
}
- 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