Integration of CDF with Microsoft Power Apps

  • 21 November 2022
  • 0 replies
  • 17 views

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.


0 replies

Be the first to reply!

Reply