Administration of Microsoft Flow can be done using the browser or you can use the new Power Modules from Microsoft to get, set or remove Microsoft Flows. Users can easily create flows in SharePoint and in their OneDrive so as a company you want to monitor and manage this behaviour. With PowerShell you can generate a list all flows that have been created and who created it. This way you can keep track on who’s building flows, which triggers and actions are users using and the current state of the flow. Company’s can create environments in Microsoft Flow and you can enforce DLP with Flow plan 2. We will also show in which Flow environment the workflow is located and how many environments there are. This script will generate an HTML file with the results. You can also go to here to create an overview of Microsoft Flows. The HTML file includes two lists:
- List of all Flow environments
- List of all Flows
Script dependencies
The script uses the MSOnline and PowerApp modules. We use MSOnline because you get only the user-id of the user who created the flow. We will match this user-id with the GUID of the user to retrieve the User Principal Name.
Flow and PowerApps share the same modules where you can find the installation guide at https://powerapps.microsoft.com/en-us/blog/gdpr-admin-powershell-cmdlets/
Creating the Flow overview
PowerShell Gallery
The PowerShell Gallery is a perfect solution to store your own scripts which you use on a regular basis where other people can also use them. The script can be found at https://www.powershellgallery.com/packages/New-FlowOverview. I always recommend reading the code first as this is a script from the internet which can be found after clicking on “Show” at “FileList”. You can also copy the script and edit it to suit your needs.
Installing the script
You can install the script using the below command
Install-Script -Name New-FlowOverview
Press Y if you want to install the script from the PSGallery.
Running the script
An example has been provided in the script info section where we will be using this same example.
Run the following command in PowerShell
New-FlowOverview.ps1 -LogPath “C:\Install”
First you need to authenticate to Office 365 and then you will need to authenticate again to PowerApps/Flow
It will show you when finished and it will open the .HTML file automatically
You can scroll down to see all the Flows and their information.
Requests
Please let me know if you want to see more information that should be valid for a Flows overview report in the comment section and I’ll add this to the PowerShell Gallery script. Please also let me know if you edited the script yourself and what you added or removed as I can learn from you in making this overview better. Personally I’m waiting for the connector information to show exactly which connector is being used so you can find out with the Office 365 license if users are using for example Gmail as a connector.