cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
samrutur
Level: Powered On

RespondTo-FlowApprovalRequest PowerShell cmdlet

Question on the RespondTo-FlowApprovalRequest cmdlet. I am attempting to use this cmdlet to set the response of an approval request to rejected but it doesn't seem to be working.

 

I tried the Add-PowerAppsAccount cmdlet to connect as the approver who has the request and an admin with P2 license. In both cases the RespondTo-FlowApprovalRequest runs without error but the approval response does not change. Ideally we need the response to change and the Flow to move on to the next step. Is there a bug with this cmdlet or may be the usage is incorrect?

 

Thank you.

 

 

6 REPLIES 6
Dual Super User
Dual Super User

Re: RespondTo-FlowApprovalRequest PowerShell cmdlet

First, what version of the PowerShell cmdlets are you using? I just downloaded and isntalled version 1.0.7 and the cmdlet is now Approve-FlowApprovalRequest or Deny-FlowApprovalRequest.  Try the most recent version of the cmdlets and see if they don't work better.  You can get them using this command

Install-Module -Name Microsoft.PowerApps.PowerShell -AllowClobber -Force


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

Re: RespondTo-FlowApprovalRequest PowerShell cmdlet

I should also add that right now the cmdlets are only for use by App Makers and Admins.  I'm not sure you'll be able to get them to work with an account that didn't create the Approval.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
samrutur
Level: Powered On

Re: RespondTo-FlowApprovalRequest PowerShell cmdlet

Thank you. I was able to install the latest module and can see these two cmdlets. Attempted to run the deny cmdlet as the account that created the approval request but it did not work. No errors as well when running it.

Dual Super User
Dual Super User

Re: RespondTo-FlowApprovalRequest PowerShell cmdlet

Was the approval addressed to the account you tried to run the Deny with?



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

Re: RespondTo-FlowApprovalRequest PowerShell cmdlet

The following worked for me if the approval was assigned to me.  I haven't tried it with a different user.  I'll try that next.

Add-PowerAppsAccount

$approval = Get-FlowApprovalRequest
Deny-FlowApprovalRequest -ApprovalId $approval[0].ApprovalId -ApprovalRequestId $approval[0].ApprovalRequestId  -EnvironmentName $approval[0].EnvironmentName -Comments "Approval Denied"


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

Re: RespondTo-FlowApprovalRequest PowerShell cmdlet

Just tried it with a regular user and it seems to work there also if I log in as the user who needs to accept or reject the approval.  The user is a maker, but didn't make this particular Flow.



-------------------------------------------------------------------------
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

Announcements
thirdimage

Power Automate Community User Group Member Badge

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

firstImage

Incoming: New and improved badges!

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

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

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