No need to do this via the API. We have a dedicated action for that. Use “Refresh dataset” in the “Power BI Command” action. See also: transformations:powerbicommand [EasyMorph Help]
In order to access Power BI REST APIs you need an access key, and to obtain it you have to create a custom application in the Power BI Developer’s portal and add it to your organization (and that would require the same admin approval), then you can begin to setup OAuth and craft and parse all responses manually...
I think waiting for admin approval is the best approach here.
Setting up custom OAuth authentication with Power BI can be pretty tedious because Azure is quite complex and requires some choices to make that are specific to your organization and its Azure setup. The process can be especially tedious if you are stuck at the very beginning of it.
First, of all you need to register an AD application, as explained here:
And here:
There you can get Client ID and Client secret.
Once you get to this point, let me know and I or someone else from our team will post further instructions.
Alternatively, write what API functions you need and we’ll see if we can quickly add them to the “Power BI command” action.
Thanks, as usual, for your willingness to help.
Well, we have a complete working setup with AAD and Power BI apps / datasets. Now is the time to get data, and especially usage metrics, from our PBI environment via the PBI Rest API.
I can already get data from the API via powershell and Postman, they use respectively a builtin PS function (Connect-PowerBIServiceAccount -Credential) and the usage of a bearer token.
You are right that the initial setup can be tedious, especially when everything is working well and they decide to enforce OAuth v2.0 ( eg )
I really appreciate the proposal to expand the “Power BI command” action. However, I personally would like to have the flexibility to create custom PBI Rest API commands. Integrating and maintaining >100 commands in the “Power BI command” action could become challenging.
I believe this information will be useful for others as well.
First, let me mention that internally we don't actually use OAuth when interacting with Microsoft services. Instead, we use MSAL, which works a little bit differently.
Secondly, based on the link you shared, it seems like you are looking to implement the 'client credential' grant flow. This is a non-interactive OAuth flow where you exchange the client_id and secret for an authorization token. Am I correct in understanding this?
Our Web Location connector's OAuth section actually implements a different flow called the 'Authorization Code Flow', which is interactive. If the 'client credential' flow is available in your environment, you should use it, as it is simpler and doesn't require Redirect URI at all.
With this flow, you exchange IDs for a token in a single POST request to the https://login.microsoftonline.com/{tenant}/oauth2/v2.0/token endpoint, where {tenant} should be replaced with your tenant.
Here is the detailed explanation how to authorize using client credentials flow:
You just need to tweak connector from example a little, to make sure the POST request points exactly to https://login.microsoftonline.com/{tenant}/oauth2/v2.0/token, something like this: