cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MAYLIWK
Helper I
Helper I

Power Automate and Common Data Services Permissions

I am currently building an approval flow that will need the requirement to cancel a current approval. I was able to find a few discussions on how to complete this task using the common data services feature within Power Automate but I am running into a security issue. The error states that I need the 'prvWritemsdyn_flow_approval' privilege. 

 

My question is on how/where to set this permission. Can anyone spell this out for me or point me in the right direction?

 

Thanks for the help 

1 ACCEPTED SOLUTION

Accepted Solutions
Jcook
Super User III
Super User III

Hello @MAYLIWK 

 

Sorry I came down with a cold and a walkthrough slipped my mind.

 

So get your admin to try this:

 

1) head to Power Platform admin center

https://admin.powerplatform.microsoft.com/support

 

2) Click Data Policies

 

3) Click Environments

 

4) Select the Environment that your Flow is in

 

5) Here you see 3 tabs <Details, Security, and Resources>

Click Security tab

 

6) Now click the button Assign security roles

 

7) A new screen will pop up, with a list of all users in the Environment. Search for the User that is using the CDS connection

This is most likely your account, but best practice would be to have a service account.

 

😎 Click on the user > which will bring up another pop up. In the top header click Manage Roles

 

9) Here is all the default roles (and custom roles if any were made) The roles you will most likely need is:

Approvals User. If you still get the error. Than try the Approvals Administrator.

Depending on your.

 

I have attached some screenshots of the above steps.

 

If you have any issues or problems after applying the above fix.

Please post the error message from flow

Thanks

Here is the Pictures:

pic1.png

 

pic2.png

 

pic3.png

 

pic4.png

 

pic5.png

 

pic6.png

 

Hope this helped.

—Josh
If you like my post please hit the "Thumbs Up" -- If my post solved your issue please "Mark as a Solution" to help others

 

 


Did I answer your question? Mark my post as a solution!

If you like my post please hit the Thumbs Up


Proud to be a Flownaut!


Check out my blog for Power Automate tips,
tricks, and guides
FlowAltDelete





View solution in original post

12 REPLIES 12
Jcook
Super User III
Super User III

Hello,

First off you will need admin rights in that environment, where CDS entities are.

My personal opinion would be to have your Org setup a Service Principal. And give that account the appropriate permissions.

If you are admin in that Environment, let me know I can post here what to do.

—Josh
If you like my post please hit the "Thumbs Up" -- If my post solved your issue please "Mark as a Solution" to help others

Did I answer your question? Mark my post as a solution!

If you like my post please hit the Thumbs Up


Proud to be a Flownaut!


Check out my blog for Power Automate tips,
tricks, and guides
FlowAltDelete





@Jcook 

Thanks for the response. Could you post the instructions? I will have to take them to the team. Also, if you have any links about how the CDS work, I would appreciate that as well. I haven't been able to find anything useful.

Jcook
Super User III
Super User III

Yes for sure. I am not near a computer right now. So I cannot walk through. I can post something on this later tonight,

Here is some information right now:

http://www.sharepointalex.uk/office-365/powerapps-creating-and-assigning-cds-security-roles/

https://community.dynamics.com/crm/b/dynamicscrmtipoftheday/posts/tip-1297-base-your-base-role-on-th...

https://docs.microsoft.com/en-us/power-platform/admin/wp-security-cds

—Josh
If you like my post please hit the "Thumbs Up" -- If my post solved your issue please "Mark as a Solution" to help others

Did I answer your question? Mark my post as a solution!

If you like my post please hit the Thumbs Up


Proud to be a Flownaut!


Check out my blog for Power Automate tips,
tricks, and guides
FlowAltDelete





@Jcook  any chance that you could post that walkthrough when you get a moment?

 

Thanks

Jcook
Super User III
Super User III

Hello @MAYLIWK 

 

Sorry I came down with a cold and a walkthrough slipped my mind.

 

So get your admin to try this:

 

1) head to Power Platform admin center

https://admin.powerplatform.microsoft.com/support

 

2) Click Data Policies

 

3) Click Environments

 

4) Select the Environment that your Flow is in

 

5) Here you see 3 tabs <Details, Security, and Resources>

Click Security tab

 

6) Now click the button Assign security roles

 

7) A new screen will pop up, with a list of all users in the Environment. Search for the User that is using the CDS connection

This is most likely your account, but best practice would be to have a service account.

 

😎 Click on the user > which will bring up another pop up. In the top header click Manage Roles

 

9) Here is all the default roles (and custom roles if any were made) The roles you will most likely need is:

Approvals User. If you still get the error. Than try the Approvals Administrator.

Depending on your.

 

I have attached some screenshots of the above steps.

 

If you have any issues or problems after applying the above fix.

Please post the error message from flow

Thanks

Here is the Pictures:

pic1.png

 

pic2.png

 

pic3.png

 

pic4.png

 

pic5.png

 

pic6.png

 

Hope this helped.

—Josh
If you like my post please hit the "Thumbs Up" -- If my post solved your issue please "Mark as a Solution" to help others

 

 


Did I answer your question? Mark my post as a solution!

If you like my post please hit the Thumbs Up


Proud to be a Flownaut!


Check out my blog for Power Automate tips,
tricks, and guides
FlowAltDelete





View solution in original post

@Jcook  Awesome!! Thanks for the help.

@Jcook 

 

We setup a service account with these permissions but I am still running into an error. Please see below.

 

\"error\":
{\"code\":\"0x80040220\",\"message\":\"Principal user (Id=aaf78868-6272-e911-a81d-000d3a37ff78, type=8, roleCount=4, privilegeCount=688, accessMode=0, is missing prvWritemsdyn_flow_approval privilege (Id=289a0b9e-b7c7-4265-992a-0b7b1e921c30) on OTC=10008. context.Caller=aaf78868-6272-e911-a81d-000d3a37ff78\",\"innererror\":
{\
"message\":\"Principal user (Id=aaf78868-6272-e911-a81d-000d3a37ff78, type=8, roleCount=4, privilegeCount=688, accessMode=0, is missing prvWritemsdyn_flow_approval privilege (Id=289a0b9e-b7c7-4265-992a-0b7b1e921c30) on OTC=10008. context.Caller=aaf78868-6272-e911-a81d-000d3a37ff78\",\
"type\":\"System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]\",\

 

Thanks for the help. 

Jcook
Super User III
Super User III

Hello @MAYLIWK 

 

Can you try and look in the Users Entity and find out which user the error is mentioning

(the guid /ID) aaf78868-6272-e911-a81d-000d3a37ff78

 

If this is your service principal account, add the sysadmin role and see if this fixes the issue

 

If the user the error is mentioning, than that user will also need the roles i mentioned before

 

—Josh
If you like my post please hit the "Thumbs Up" -- If my post solved your issue please "Mark as a Solution" to help others

 

 

 


Did I answer your question? Mark my post as a solution!

If you like my post please hit the Thumbs Up


Proud to be a Flownaut!


Check out my blog for Power Automate tips,
tricks, and guides
FlowAltDelete





@Jcook 

 

Thanks, turns out it was still using my account while testing. 

 

One last question. I was able to update the approval record and it disappeared from the action items list on power automate website. However, it doesn't allow the workflow that's waiting for an approval response to continue after I update the approval record.

 

I manually cancelled an approval and looked at the approval record after I cancelled to compare the fields to what I am filling in. Looks like I have everything but one field. msdyn_flow_approval_result is coming back with a null for the record I canceled via power automate but it is coming back with "Canceled" for the approval I manually cancelled.

 

Manually cancelled meaning I went to my sent approvals with the Power Automate web site and hit the cancel button. 

 

I cant see the field within power automate that this correlates to. Do you know if there is one or will I have to create my own "wait for an approval" action with a loop?

 

Thanks

Jcook
Super User III
Super User III

@MAYLIWK 

Could you share a picture of what the flow looks like?

 

—Josh
If you like my post please hit the "Thumbs Up" -- If my post solved your issue please "Mark as a Solution" to help others

 


Did I answer your question? Mark my post as a solution!

If you like my post please hit the Thumbs Up


Proud to be a Flownaut!


Check out my blog for Power Automate tips,
tricks, and guides
FlowAltDelete





@Jcook 

 

Not sure which one you wanted. Here is the approval flow:

 

image.png

and here is the cancel flow (its just a test flow for now being triggered by an http request that I fill in the IDS manually

 

image.png

Jcook
Super User III
Super User III

@MAYLIWK 

When you said you updated the Approval.

Is that from Flow or from the email / actions page?

 

Im wondering if you changed your action to Start and Wait for an Approval instead?

 

—Josh
If you like my post please hit the "Thumbs Up" -- If my post solved your issue please "Mark as a Solution" to help others

 


Did I answer your question? Mark my post as a solution!

If you like my post please hit the Thumbs Up


Proud to be a Flownaut!


Check out my blog for Power Automate tips,
tricks, and guides
FlowAltDelete





Helpful resources

Announcements
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Users online (21,075)