How To Connect Power Query (Power BI) To Cloud Orchestrator API

How to connect Power Query (Power BI) to Cloud Orchestrator API ?

To connect Power Query to the Cloud Orchestrator API, it is possible to use data analytics tools such as Power BI to create reports and dashboards, using data from Orchestrator.

This tutorial will show how to connect to the Orchestrator API data source. Note that if direct connection to the SQL Server database can be made, then there is no need to use the API. The method detailed here is useful in situations where it is not possible to access the SQL Server database directly either due to firewall constraints or other access issues.

Setup the API Account : You may want to consider creating a specific account for the API access. As the password will be hard-coded in the query in a later step, it would be a good idea to have an account specifically for the API access.

  1. For example, create a role called API that has read-only access as following,


  1. Then create a local account (Non-AD account) and assign it the API role

Any local account that has a password can be used( Do not use an AD authenticated account). But creating a special account for the API access, with just the permissions required would be the best practice.

Once the account is created, remember to login at least once to change the password, as it is required to change the password after the first login. Post the password change, take note of the new password for the next steps.


Power Query: Post the local account creation and having reset the password, it is now time to use Power Query to authenticate and connect to the data source. For the screenshots, Power Query will be used that is built into Excel 2016. However, the queries are exactly same as in Power BI Desktop.

Authenticating: Authenticating to the API requires the use of a bearer token as documented in the Orchestrator Reference guide. A query needs to be crafted that retrieves the bearer token and then passes the bearer token to the API request.

  1. First create two queries: one to store our base URL and one to store our credential information
  2. Click on New Source -> Other Sources -> Blank Query. Rename this query as BaseUrl (note, Power Query is case-sensitive) then open the Advanced Editor. The query here, will be simple:

let

Source = "https://cloud.uipath.com/Account Name"

in

Source

  1. Replace the URL with the URL for your Orchestrator instance. At the end, you should have a query that looks something like this:


  1. Click Done
1.png
  1. Next, create a record to store the credential information. Create a new blank query and name it Credentials. In the Advanced Editor type in:

2.png

  1. Obtain the client Id and refresh them from the cloud Orchestrator instance. Follow the below steps:
  2. Login to your Automation Cloud account.
  3. Navigate to Admin > Tenants. The Tenants page is displayed with a list of all existing tenants.
  4. Expand the desired tenant to display the available services.
  5. Click API Access () for the corresponding Orchestrator service. The API Access window is displayed with the following service-specific information:
  • User Key - allows you to generate unique login keys to be used with APIs or with 3rd party applications in order to log in and perform actions on your behalf. This was previously known as your refresh token.
  • Account Logical Name - your unique site URL, (for example cloud.uipath.com/yoursiteURL).
  • Tenant Name - the display name of the tenant.
  • Client Id - specific to the Orchestrator application itself, is the same for all users and tenants on a specific platform. For example, all the tenants on cloud.uipath.com have the same Client Id value.
  1. Do not close this page. You need the information within it to make the authentication call.
  2. Copy the values clicking the button next to each of these fields.
Pic.png

Authenticate URL - https://account.uipath.com

  1. Replace the Path variable with any API call as documented in the Orchestrator Reference guide. There is no need to modify other lines, as long as you setup the BaseUrl and Credentials queries as specified above.
  2. At this point, a pop-up message asking you to specify how to connect may be encountered. Click on Edit Credentials and then select Anonymous_ access. Then another popup might be obtained about data privacy. Depending on your use case, you may select Public or Organizational.

If above suggested steps are performed correctly, see the results as something like this:

At this point, expand the list, convert it to a table, and perform any other Power BI data transformation to get the data required.

For example:

2 Likes

The images for setting the Credentials are not loading. Can you reupload those?

1 Like

The images for setting the credentials are not visible, can someone send them to us?

1 Like

A post was split to a new topic: How do I connect to Cloud Orchestrator?

The missing images are visible in this post: https://forum.uipath.com/t/tutorial-connect-power-query-power-bi-to-orchestrator-api/88654

2 posts were split to a new topic: Connect Power Query (Power BI) to Orchestrator API - authorization issue

I can’t seem to get this working. Would someone be able to provide a sample .pbix files to help get me rolling quicker?