How to – use HTTP Action to call DataVerse / Dynamics 365 Web API in Power Automate


Let us take a simple example, to see the steps involved.

Here we will be manually triggering a flow, getting the token, and calling the WhoAmI request in Microsoft Dataverse / Dynamics 365.

This is how our final Flow looks like.

Inside the first HTTP action, we are calling OAuth 2.0 token endpoint v1. We have MyCrmApp registered in Azure AD and have generated the client secret for it.

Also we have created an Application User using the above application details and have given the appropriate security role.

Below is how our HTTP request looks like.

 

Method

POST

URI

https://login.microsoftonline.com/489f9a0f-1326-42ae-a00c-0dd3cd16e6e9/oauth2/token

Headers

 

Content-Type

application/x-www-form-urlencoded

Body

grant_type=client_credentials&

client_id=ad7a1cc4-123f-4270-9c11-29eb1686e203&

client_secret=m7.xyzsdfsdfe.jZ0odh-C-85qg70QPfnsI&

resource=https://[orgname].crm.dynamics.com/

Next, we have added the Compose action to get the token from the output of the HTTP request.

 

Inputs (Expression) = outputs(‘HTTP’).body.access_token

Next, we have added the HTTP action again to calls the WhoAmI request using the above token.

Method

GET

URI

https://trialcrm.api.crm.dynamics.com/api/data/v9.2/WhoAmI

Headers

 

Content-Type

application/json

Authorization

Bearer [Output of the previous step]

On triggering our Flow succeeds as shown below.

The output of the first HTTP request.

Compose step has the access token

And the final step has the result of the HTTP Get request to WhoAmI

The helpful post –

https://carinaclaesson.com/2019/11/24/using-power-automate-to-trigger-on-create-or-update-in-the-cds-and-make-http-requests-with-oauth-2-0-authentication/

https://sharepointmadeeasy.blogspot.com/2018/02/microsoft-flow-http-rest-api-invalid.html

Hope it helps..

Check other posts on Power Automate

Advertisements

Author: Nishant Rana

I love working in and sharing everything about Microsoft.NET technology !

5 thoughts on “How to – use HTTP Action to call DataVerse / Dynamics 365 Web API in Power Automate”

  1. Hi Nishant,

    If the requirement is just to call D365 action or CRUD operation Azure AD connector is already available to be used in flows which will take care of access token management.

    Thanks

    Liked by 1 person

Please share your thoughts

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

Power Spark

Power Spark By Shrangarika

Van Carl Nguyen

Exploration of Power Platform

My Trial

It is my experience timeline.

Power⚡Thomas

Sharing my knowledge and experience about the Microsoft Power Platform.

Arpit Power Guide

a guide to powering up community

Welcome to the Blog of Paul Andrew

Sponsored by Cloud Formations Ltd

Deriving Dynamics 365

Deriving Solutions and features on Power Platform/Dynamics 365

The CRM Ninja

Thoughts & musings from a Dynamics 365 Ninja!

D CRM Explorer

Learn about Microsoft Dynamics CRM Power Platform customization and implementation and other cool stuffs

Stroke // Jonas Rapp

I know pre-stroke. I will improve who I was.

Power Melange

Power Melange By Shalinee

Clavin's Blog

Power Automate - Power Apps - SharePoint Online - Azure - Nintex - K2 - Artificial Intelligence

Sat Sangha Salon

An Inquiry in Being

The Indoencers

The Influencers & Influences of Indian Music

Monika Halan's blog

Hand's-free money management

D365 Demystified

A closer look at Microsoft Dynamics 365.

Microsoft Mate (msftmate) - Andrew Rogers

Experienced consultant primarily focused on Microsoft Dynamics 365 and the Power Platform

Knowhere365

Specific topics by Django Lohn on the whole Microsoft365 Stack

Manmit Rahevar's Blog

One Stop Destination for Microsoft Technology Solutions

MG

Naturally Curious

Brian Illand

Power Platform and Dynamics 365

Steve Mordue MVP

A Microsoft Business Applications MVP

Subwoofer 101

Bass defines your home theater

SQLTwins by Nakul Vachhrajani

SQL Server tips and experiences dedicated to my twin daughters.

Everything D365

Discovering Azure DevOps and D365 Business Applications

Tech Wizard

Lets do IT Spells

XRM Tricks (Power Platform & Dynamics CRM )

Power Platform & Dynamics CRM

CRM TIPS BY PRM

Mail to crmtipsbyprm@gmail.com for queries and suggestions

nijos.dev

Giving back to the community what I have learned

xrm CRM Dynamics

Dynamics CRM Technical & Functional Info

Dynamics 365 Blogs - Explained in unique way

Sometimes you need to look at things from different perspective.

CRM Keeper

Dynamics 365 Customer Engagement, CRM, Microsoft CRM, Dynamics CRM