Flow missing export to logic app? Use the CLI for Microsoft 365

Flow missing export to logic app? Use the CLI for Microsoft 365 header image

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. Due to licensing changes the flows where throttled. As a result, they have 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 quire 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. Missing option to export Flow to Logic App

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 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 environnement you are looking for, and the display name Test to the flow you are looking to export! I hope 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

Loading comments…