Hello,
I am currently developing a backup solution for the workflows in my company's environment.
The solution consists of two flows. The first uses Power Automate Management Connector activities "List flows as Admin" and "Get flow", collecting relevant flow data and saving two files in a SharePoint folder. The flow definition is stored as a JSON file, while the connection references are saved as a text file.
The second flow receives the name of the flow I want to restore. It searches for the flow's definition and connection references in the files saved, and then passes them to the "Create Flow" activity using the Power Automate Management connector.
However, I am encountering an issue when attempting to create the majority of flows using the "Create Flow" activity. I receive the following error message: "The flow save failed with the code 'WorkflowRunActionInputsInvalidProperty' and the message 'The 'inputs' of workflow run action 'Run_a_flow_created_with_Power_Automate_for_desktop' of type 'OpenApiConnection' should not have the property 'authentication'.'"
I attempted to remove the 'authentication' property from the JSON body, but unfortunately, the error message changed to: "The flow save failed with the code 'WorkflowRunActionInputsMissingProperty' and the message 'The 'inputs' of workflow run action 'Run_a_flow_created_with_Power_Automate_for_desktop' of type 'OpenApiConnection' is not valid. Property 'host.connectionReferenceName' is missing.'"
I have spent a considerable amount of time trying to understand this issue, but I am still unable to comprehend why it is occurring. It is puzzling to me because the service account I am using for these runs has the Office 365 environment admin role, connections permissions, and the flows I am attempting to restore were created by the same account.
Could someone please help me understand this situation? This is currently the only method I have found to create flows automatically using Power Automate.
Thanks!, that atwork post is the only documentation that has successfully showed me how to get the Create Flow action to work. Specifically the fact that the Connection Reference parameter can only have the "connectionName" and "id" as part of the array. With the solution using the "Select" action to recreate the array with just those keys.
I get an API error using the Create Flow connector too. Here is a workaround that worked for me:
https://blog.atwork.at/post/backup-and-restore-a-flow-with-another-flow