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

Create Power BI Report to analyze Dataverse / Dynamics 365 data in Azure Data Lake


To begin with, here we have already configured the Azure Synapse Link /Export to Data Lake service and have configured Account, Contact and User table for the sync.

Check posts on Azure Synapse Link/  Export to Data Lake service:

https://nishantrana.me/2020/12/10/posts-on-azure-data-lake/

Let us now create the Power BI report on the exported data –>

Sign in to Power BI Desktop.

Click in Get Data and select Azure >> Azure Data Lake Gen 2 connector and click on connect.

Navigate to the storage account and the container within it and click on Container properties.

Copy the URL

Replace the blob part https://saazuredatalakecrm.blob.core.windows.net/dataverse-pmaurya105-unqdc8ed1c1df824188bbe2225de96f0

with the dfs

https://saazuredatalakecrm.dfs.core.windows.net/dataverse-pmaurya105-unqdc8ed1c1df824188bbe2225de96f0

Enter the URL and select CDM Folder View


Sign in with the Azure Active Directory account or with an Account key.

In case if you get the “Access to the resource is forbidden” error.

https://nishantrana.me/2020/09/07/error-access-to-the-resource-is-forbidden-while-trying-to-connect-to-azure-data-lake-storage-gen2-using-power-bi-desktop/

Here we have selected the Contact, Account, and System User table.

Click on Load.


Here we’d create a basic report that shows Contact’s full name, email, along with Account Name (left join with Account) and Owning User Full Name (left join with System user)

Let us choose the appropriate columns from the contact table.

fullname, emailaddress1, owninguser, ownerid_entitytype, parentcustomerid, parentcutsomerid_entitytype, parentcustomeridname


Now to get the full name of the owning user and the Account’s name, let us left join the contact table with the system user and account table.

Select Merge Queries as New in the Power Query Editor.



Merge Contact with Account


Merge with System User


Expand the account column and select the name field for the merged query.


Similarly, select fullname for the systemuser.


Close and apply the updates.


Below we have our report ready.



Save and publish the report.

More posts on Power BI – https://nishantrana.me/2018/11/24/power-bi-and-microsoft-dynamics-365/

Hope it helps..

Advertisements

Error – “Microsoft SQL: A network-related or instance-specific error occurred while establishing a connection to SQL Server” – while trying to use Dataverse connector in Power BI


While trying to use Dataverse connector inside Power BI Desktop

we got the below error

Details: “Microsoft SQL: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 – Could not open a connection to SQL Server)”

Later we realized we were not entering the environment details in the correct format as expected

i.e.

[orgname].[crm].dynamics.com

We were entering it incorrectly  below with the https

Entering URL in correct format fixed the issue for us.

In case if TDS endpoint it not enabled –

we will get the below error

i.e. Microsoft SQL: TDS Protocol endpoint is disabled for this organization.

Check more posts on Power BI

https://nishantrana.me/category/power-bi/

Hope it helps..

Advertisements

Use Power BI to analyze the CDS data in Azure Data Lake Storage Gen2


In the previous post, we saw how to export CDS data to Azure Data Lake Storage Gen2.

Here we’d see how to write Power BI reports using that data.

Open the Power BI Desktop, and click on Get data

Select Azure > Azure Data Lake Gen 2 and click on connect.

To get the container URL,

Log in to the Azure portal and navigate to the container and click on Properties and copy the URL.

Replace the blob part in the copied URL with dfs

Below is the format of the URL.

https://accountname.dfs.core.windows.net/containername/

replace the account name and the container name.

In case you get the below error

Refer –

https://nishantrana.me/2020/09/08/error-we-dont-support-the-option-hierarchicalnavigation-parameter-name-hierarchicalnavigation-when-trying-to-load-table-in-power-bi-desktop-using-azure-data-lake-storage-gen-2-cdm-fo/

Select the CDM Folder View (beta)

Expand the CDM folder and select the entity.

In case if you get the below error

Refer

https://nishantrana.me/2020/09/08/error-we-dont-support-the-option-hierarchicalnavigation-parameter-name-hierarchicalnavigation-when-trying-to-load-table-in-power-bi-desktop-using-azure-data-lake-storage-gen-2-cdm-fo/

Once connected we can then create our Power BI report as shown below.

Check the below posts for creating a Power BI report with Dynamics 365 data as the source

https://nishantrana.me/2018/11/24/power-bi-and-microsoft-dynamics-365/

Posts on Azure Data Lake

Hope it helps..

Advertisements

Error – We don’t support the option ‘HierarchicalNavigation’. Parameter name: HierarchicalNavigation when trying to load table in Power BI Desktop using Azure Data Lake Storage Gen 2 CDM Folder view (beta)


While trying to connect to a table within Azure Data Lake Storage Gen2 through CDS Folder View

we got the below error

Users have reported this issue with the August 2020 Update of Power BI Desktop.

As suggested in the forums, downgrading to June 2020 Update fixed the issue for us.

Check out Export CDS data to Azure Data Lake Storage Gen2

Posts on Azure Data Lake

Hope it helps..

Advertisements

Error – Access to the resource is forbidden while trying to connect to Azure Data Lake Storage Gen2 using Power BI Desktop


While trying to connect to Azure Data Lake Storage Gen2 through Power BI Desktop we got the below error

Came as surprise cause the user was had the owner role assigned to the container

It turned out we need to assign the Storage Blob Data Reader role to the user.

After assigning the role we were able to connect successfully.

Posts on Azure Data Lake

Hope it helps..

Advertisements