web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Need to use a script i...
Power Automate
Unanswered

Need to use a script in my flow with variables from the user that is submitting the flow

(0) ShareShare
ReportReport
Posted on by 53

Hi there,

 

I have a question and can't find the answer online. Because microsoft doesn't have the option to mass add users in app permission policies I want to do that via power shell. I have managed to do it via powershell but want the script to be variable.

 

Is this possible?

 

I have a rule in the powershell script that wants an upn as Identity.

Can I get the upn in the script based on the user that is submitting the flow?

 

Regards

Ouss

Categories:
I have the same question (0)
  • VictorIvanidze Profile Picture
    13,079 on at

    Hi,

    as far as I know you cannot run PowerShell commandlets from a Power Automate flow.

  • Kabilesh Profile Picture
    177 on at

    Hi @Ousselg 

     

    You can use Run Script Action in Power Automate.

     

    Please make use of the attached link to see how to create a script.

    https://learn.microsoft.com/en-us/office/dev/scripts/develop/power-automate-integration

    https://www.youtube.com/watch?v=v-_joMcPpLI

     

    In that you can pass dynamic values into the scripts and even while using manual trigger.

     

    Best Regards,

    VK

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • Ousselg Profile Picture
    53 on at

    @Kabilesh I don't see the part on how to pass dynamic content from the flow in the script.

     

    Can you help out with that part ?

    I need the get the upn from the user running the flow to add the user to a teams app policy group. This cannot be done by adding the user to an azure group as you have to call the ms teams module first and add the users to that policy via powershell.

     

    And how can the user use the ms teams powershell module without admin rights? Can the module run under system ?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
trice602 Profile Picture

trice602 237 Super User 2026 Season 1

#2
David_MA Profile Picture

David_MA 176 Super User 2026 Season 1

#3
Power Platform 1919 Profile Picture

Power Platform 1919 96 Super User 2026 Season 1

Last 30 days Overall leaderboard