Skip to main content

You can load data from Cognite Data Fusion (CDF) into Microsoft Power Apps, where you can build custom apps for your business needs.

This article explains how to create and connect a custom Power Apps connector with the Cognite API and build a canvas app.

Before you start

To perform the steps below, you need to be an administrator of Azure AD. Make sure you have registered the Cognite API and the CDF portal application in Azure AD and set up Azure AD and CDF groups to control access to CDF data.

You'll also need to register a custom web app in Azure AD to give Power Apps access to the CDF data. Make sure to register the redirect URI, https://global.consent.azure-apim.net/redirect under Authentication > Add a platform > Web.

Step 1: Create and authenticate a custom connector

  1. Sign in to Microsoft Power Apps with your Microsoft account.

  2. Start from Dataverse > Custom Connectors.

  3. Select New custom connector > Create from blank.

    Project
  4. On the General information tab:

    • Host: Enter https://<clustername>.cognitedata.com as host URL.
    • Optionally, fill in the remaining fields.
    • Select Create connector.
  5. On the Security tab:

    • Authentication type: Select OAuth 2.0.
    • Identity provider: Select Generic OAuth 2.
    • Client id is the ID of the application in Azure AD.Read more.
    • Client secret is the client secret of the application in Azure AD.
    • Authorization URLhttps://login.microsoftonline.com/<AAD_tenant_id>/oauth2/v2.0/authorize
    • Token URLhttps://login.microsoftonline.com/<AAD_tenant_id>/oauth2/v2.0/token
    • Refresh URL is identical to the token URL.
    • Scope<clustername>.cognitedata.com/user_impersonation offline_access
    • Redirect URL: Leave this field empty.
  6. Select Update connector.

  7. On the Definition tab:

    • Under Actions, select New action.
    • Enter a summary, a verbose description, and an operation ID that identifies the action.

    In the Request section:

    In the Response section:

    • Select Add default response.
    • Copy the response sample from the Cognite API docs for the action and paste it into the Body field.
    • Select Import and make sure the validation succeeds.
    • Select Update connector.
  8. On the Test tab:

    • Select the connection created above and click Test Operation.

Step 2: Build an app using the custom CDF connector

  1. Sign in to Microsoft Power Apps with your Microsoft account.

  2. Start from Home and select Blank app > Blank canvas app.

  3. Click Create, enter an app name, and select a format.

  4. Select Data (Data icon) in the sidebar and find the connector you created above as the data source.

  5. Under Insert, select Label, and fetch the properties you want to show in the app by entering a Text function in the formula bar. For instance, the asset name. Read more about formulas.

  6. Continue to fetch the properties you want to add to the app, such as data tables, charts, etc.

  7. Select Save and Publish and share the app with other users.

i am hoping this will be a live connection.


This is the setup on how you can build a connector for CDF in Power Apps. You can certainly make it live by passing the timeseries/Asset/Events ID as a parameter to the URI and triggering the event URI by means of power automate/logic app or any other event driven tool.


Hi Ankit, you mention it is possible to Load Data from CDF. Can the same principle be used to Write back to CDFv via PowerApps forms?


If you have configured the permission you can, by calling the right POST/PUT cdf apis..


@hescalona  @Ankit Kumar  - I am using Azure Logic Apps to load data from Sharepoint to CDF raw or files. Is there any userguide for doing the same. 


any reason why using Logic app for that? I believe we have a SharePoint extractor for this


We tried that as well, but it has limitations like it does not support Sharepoint list. It does not support sites deployed as "/teams".


I see, I was not aware of the limitations. But then coming to original question, I haven't tried with SharePoint as a source yet.


Thanks for your reply, apart from ADF is there any other Azure service we could use to read sharepoint and load to CDF? In Azure Logic App we have multiple options like HTTP, Postgres etc.. but no specific userguide available to load data to CDF using these. 

 


While Azure Logic Apps and Power Automate offer powerful automation capabilities, it's important to note potential limitations when dealing with bulk data. Concerns such as loading large datasets and managing data size could arise. To address this, leveraging Azure Functions emerges as a viable solution. By employing Azure Functions, we can precisely tailor the process of reading data from SharePoint and invoking CDF APIs for storage. While it may involve some coding efforts, this approach ensures a more customized and scalable solution, providing greater flexibility compared to the out-of-the-box options available with Azure Logic Apps and Power Automate for handling SharePoint-CDF integration.


Thanks for helping me understand pros and cons. 


@Ankit Kumar  - Thank you for above, I just want to check if we have an extractor for PowerApps today to read and write data from Cognite to PowerApps.

cc - @Haw Keat Lim 


@Hitesh Anchan not today but we will have one very soon as we are working on a PowerApps-CDF connector but that will be supporting Data Models and Timeseries to start with. to work with other resources types you might have to still follow the custom connector way as described above.


Reply