Garry Trinder Cloud Developer Advocate

Export all your Power Automate Flows using CLI for Microsoft 365

When was the last time you backed up all the Flows in your environment?

By combining the CLI for Microsoft 365 and PowerShell we can make this task easy and repeatable.

This script will get all Flows in your default environment and export them as both a ZIP file for importing back into Power Automate and as a JSON file for importing into Azure as an Azure Logic App.

The script assumes that you have already logged into your Microsoft 365 tenant using the m365 login command.

See Logging in to Microsoft 365 in the user guide.

CLI for Microsoft 365 is associated with the Microsoft 365 Patterns and Practices (PnP) organisation, which is a virtual team consisting of Microsoft employees and community members focused on helping the community make the best use of Microsoft products.