User impersonation in Power Automate flow
In the Dataverse connector triggers and actions in Power Automate cloud flow I like using the user impersonation feature. With this feature you act as the user that triggered the flow. This is very useful if you need to act in the context and privileges of that user. If you created classic workflows in Dynamics 365 you probably are familiar with this concept. There it is known as the feature Execute as user.
?User impersonation in Power Automate is a two-step process. In the first step you need to show the advanced options in the Dataverse trigger and choose Run as: Modifying user. You could also choose Row owner if you need to act as the user that’s owner of the record concerned. You must have the Microsoft Dataverse privilege Act on Behalf of Another User (prvActOnBehalfOfAnotherUser). The Delegate and System Administrator security role includes this privilege by default. You can enable it on any security role. Additionally, you could change the scope of the flow to take the user’s privileges into account.
For the second step you need to create an action for the Dataverse connector. In this action you open the meny by clicking on the ellipsis in the top right corner of the action. In the side menu check Use invoker’s connection. All the Dataverse actions in this flow now use invoker’s connection and this can be set back to the default in each individual action. The changed will be registered on the user that triggered the flow and shown as such on the audit log. If that user doesn’t have the privilege in Dataverse to perform the action, the action won’t succeed. In some cases this is a good thing. ??
Sales and consulting professional
2 年Keep up the good work Timothy, and keep'em coming