How to use the Dataverse Web API

In this article I am going to demonstrate how you can use the Dataverse Web API within a Power Automate flow. In this example a description of a phone call activity is updated. This is a note to self kind of article.

Table as a variable

In the Power Automate community Stanza asked help with specifying a table name dynamically by using a variable. However, this didn’t work with the out of the box Update a record action.

As far as I am aware this is a limitation of that Update a record action. However, it is possible to connect to Microsoft Dataverse tables directly via the Web API.

Register an App with Azure AD

Before you continue to the Power Automate setup you need to be able to communicate with the Dataverse Web API.

First step is to register an app in Azure Active Directory. Elaiza Benitez has written a nice blogpost about this, How to authenticate as an application with Microsoft Graph API with flow.

The only difference is that you need to select the Microsoft Dataverse permissions instead of the Graph Permissions.

Application User

Update 09-07-22: Since I published this article the Power Platform admin interface has slightly changed. Follow these steps instead for the creation of an application user.

When you are interacting with the phonecall table you are dealing with a Customer Engagement table. To interact with this kind of data you need to setup an additional application user within your Dynamics 365 Customer Engagement environment.

1. Go to the Org url, something like
2. Go to Gear Icon and find the Advanced Settings.
3. Navigate to Settings > Security > Users
4. Switch to Application Users view.
5. Click New.
6. Enter the Client Id of the Azure AD App in the Application ID field and save the record
7. Assign a Role, via Manage Roles

Patch request

When you have created the Azure AD app and the application user you should be able to use an HTTP action to interact with the Web API. Below is an example of that.

1. Add a HTTP action. The method is PATCH and in the URI field I am using the Microsoft Dataverse Web API. I am also using a variable for the entity, making this a flexible solution.


2. In the body you can set for instance the description field. Below is a public gist with the configuration I used in my HTTP action.

3. For the authentication I am using OAuth with a couple of variables for the audience, client id and the secret.


That should be it. Happy testing!

You may also like...

5 Responses

  1. Shehab says:

    Amazing especially the authentication part. That saves 2 stepss in the flow and makes it easily readable.

  2. Jason says:

    I’m really happy i found your blog! I was struggling with authentication due to unknowingly using the wrong authority and audience. It is now working perfectly, thank you.

  3. Eli says:

    Will I need a new app registration/application user per environment if I plan to follow an ALM?

  4. Dennis says:

    Hi Eli,

    The application user would be per environment. The app registration could be only one. However, from a security point of view it probably is better to have separate app registrations as well.

  5. Mohammed Youser Sawwas says:

    Hi Dennis,

    This is Mohammed, a Software Developer in UAE.

    Thank you for your article (How to use the Dataverse Web API)

    but I want to ask you please:

    Whenever I try to do a Patch operation (Rest API) on a resource in client Dataverse, I receive the following error :
    401 Unauthorized, Authentication failed to that URI…

    I have a generated token successfully and added it as Authorisation header
    It works for Get operation
    but fails for Patch one.

    Kindly, have you got any idea about what should I do to be able to run Patch operation?

    Currently, I don’t know: secret, tenant ID ,
    Are they a must? or I can use only the generated token(which works fine for Get operation)

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.