Lets add a command to import a flow.
This can be done using the ImportSolution method of the Microsoft Flow Web API
Will be keen to implement this.
Just to double check the above spec: in the list of arguments, file should be environment and format should be file? Other than that, sounds cool and appreciate your help! All yours!
Oops, yes. Here the updated version:
Given that in the export command we're specifying a path to the file on disk, why not point to the file path here as well, rather than having users base64-encode the file first and pass its contents as an option?
@HubSaul just checking if you've seen my last remark and are still working on this?
Setting as available for taking due to lack of response
I am taking that!
I cannot proceed due to https://github.com/pnp/office365-cli/issues/1048. I might be missing something in the setup. Once that is solved I will proceed.
Ok, ignore my previous comment. I just realized that Flow does not run under application permissions and I was logged in with my own azure ad app instead of device login.
This is free to be picked up. I currently do not have all that time this command requires.
Do you have any work in progress that you could share that could help whoever is to pick this up next?
Not really, I tried to reverse engineer the UI and recorded many requests in notepad to some point where I got lost and decided that this is exercise for when I have more time.
Hi. I'll pick this back up and progress it. Thanks Saul
A while I did something similar @VelinGeorgiev and noticed that if the Flow you want to import has connections, it can't be imported because the connections require setup in the UI and if you don't do it, the import is not completed. I hope something has changed since then, which would allow us to programmatically import Flows.
Not really. By the time I tryied the connections still had to be setup. It is not impossible, but it might requite more work.
Hey @HubSaul 馃憢馃徎 are you still working on this?
Changing to available due to lack of response
The original issue description for this command refers to requiring the ability to use the Azure Management Service, however the ImportSolution endpoint also referred to is exposed by the Power Automate Web API which uses the Common Data Service (CDS) to import Flows that are contained within a solution, into the CDS environment.
Using a solution and the PA Web API appears to be the preferred approach as the documentation refers to creating connections following the import.
Once import has completed successfully, you will need to set up the connections for the flow, since the connectionNames will likely be different in the destination environment (if the connections exist at all).
The only challenge I see with using the CDS is that not everyone has it and that it might limit people from using our command. On the other hand, if this is the only way to import flows, then there is not much we can do about it.
Agree with your comment on CDS.
For me it is clear that there are now two commands for importing a Flow.
The latter would require additional effort as we would need to add consent for Power Automate Web API and also update our request module to handle the complexity of obtaining the correct baseUrl for requests to a CDS environment.
Based on the differences, should there be two distinct command for it given the outcome of the import is not quite the same?
Yes, I believe so.
I think we should update this issue to refer to the importing of a Flow to a target environment using the Azure Management Service API and raise a new issue for the importing of a flow into a CDS solution.
Agreed @garrytrinder
Most helpful comment
I am taking that!