Find Flows using JMESPath queries
Sometimes it can be challenging to find a specific cloud flow. You simply don’t know the exact name or other type of details to easily find it in the interface. In this article I will show you how to use CLI for Microsoft 365 and JMESPath queries to find Power Automate cloud flows.
Inspiration
This question from Kosenurm:
Is it possible to create a flow/run a script to list all flows across my entire Power tenant where the HTTP action is used, showing:
– Flow Name
– HTTP request type (e.g. GET, POST etc)
– the URI the action is using currently.
Power Users Community thread: See all HTTP actions in use across tenant.
Why use CLI for Microsoft 365?
When using the CLI for Microsoft 365, you can manage your Microsoft 365 tenant and SharePoint Framework projects on any platform. No matter if you are on Windows, macOS or Linux, using Bash, Cmder or PowerShell, using the CLI for Microsoft 365 you can configure Microsoft 365, manage SharePoint Framework projects and build automation scripts.
I would say that is a unique selling point 🙂
Flow commands
CLI for Microsoft 365 has commands for a lot of different products. The command we are interested in today is the flow list command. With this command you can list Power Automate flows in a given environment.
One of the interesting options is –query, which can use JMESPath queries. Albert-Jan Schot has a written a great blogpost about JMESPath queries for CLI for Microsoft 365. I can highly recommend reading that blog first to get to know the basics of JMESPath queries.
Find flow examples
To get started I have shared a couple of example JMESPath queries for finding Power Automate flows. I might add some more in this blog in the near future as well.
To use these samples make sure you login to the Microsoft 365 tenant first and you use the correct environment id. If you are unsure what your environment id is you can use the flow environment list command to find it.
#1 List flows where displayName is equal to ‘Hello World’
#2 List flows where displayName contains ‘Hello World’
#3 List flows where displayName starts with ‘Hello World’
#4 List flows with a HTTP action
#5 List flows with a Send an HTTP request to SharePoint action (SharePoint Online connector)
#6 List flows with a Update Item action (SharePoint Online connector)
#7 List flows with a Update a Board action (Trello connector)
Happy testing!