Flow missing export to Logic Apps? Use the CLI for Microsoft 365!

20 januari 2021

Sometimes you have these moments that it all comes together. During a recent call we had a customer who had some issues with one of its flows in Power Automate. Due to licensing changes the flows were throttled. As a result, they decided to migrate to Logic Apps for some more control. During this migration it turned out that some flows could not be exported to Logic Apps.

Missing option to export to Logic Apps

Not quite sure as to why the option is missing. The option is available on all older flows but flows created as of 12-01-2020 seem to be missing the option to export. We checked the obvious around permissions or connectors that are not supported. Yet it looks like it is only missing from the UI. We could even copy an 'old' flow to a new one and could see the option was missing from the new one while still available in the old. 


CLI for Microsoft 365.

Luckily, there is still a way to export a flow. Using the CLI for Microsoft 365 you can use the m365 flow export option. It allows you to export the JSON using a command line interface. It turns out that the option works perfectly even though it is not available in the UI. So just in case that you need to migrate a Power Automate flow to Logic Apps you can use the following snippet to export it to JSON.

$environmentId = $(m365 flow environment list --query "[?displayName == 'Digiwijs (default)']"
-o json | Convertfrom-Json).Name 
$flowId = $(m365 flow list --environment $environmentId --query "[?displayName=='Test']"
-o json | ConvertFrom-Json)[0].Name

m365 flow export --environment $environmentId --id $flowId -f 'json'

Make sure to change the display name Digiwijs (default) to the FLow environment you are looking for, and the display name Test to the flow you are looking to export! I hope that the UI option gets fixed quickly, but in the meantime, this should be sufficient to get you running again. Definitely a +1 for the CLI in my book. 

Source: https://www.cloudappie.nl/cli-m365-exportflow/


Submit a comment