Showing results for 
Search instead for 
Did you mean: 
Level: Power Up

Trigger a PowerShell Script in Flow when Receiving an Email


I'm looking to create a Flow that will run a PS script (On prem or in Azure) when an email is received. The email would come from a certain user and would contain a phrase in the subject. If this is not possible what about using a Button to trigger a PS script? In that case I would like to share that button with a user. Thanks in Advace! 


Dual Super User
Dual Super User

Re: Trigger a PowerShell Script in Flow when Receiving an Email

First, there is no way to expose a button in Flow since it runs in the background. There is also no way to invoke PowerShell in an on-premises environment from Flow.  Flow runs on the server in the cloud and you need to invoke the script on a computer in the on-premises environment. I have read that you can create an Azure Function that can invoke PowerShell.  You could then invoke that function from Flow.  Here's an article on how to create an Azure function to invoke PowerShell.

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Helpful resources


Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!


Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!


Microsoft Learn

Learn how to build the business apps that you need.


Power Platform World Tour

Find out where you can attend!


Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (4,956)