Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Anonymous
Not applicable

Power BI OAuth2 token get Rest service only works on-premises

I've only been using PowerBI for a short time.

 

I'm using the Rest services of Power BI, from a web application, and to obtain the Token, I use the following call (although logically embedded in .NET code):

avazquezu_0-1657888462604.png

It works correctly when consumed from local, but when we deploy to the development environment, and we try to obtain a Token Oauth2, the application gives an error "System.OperationCanceledException", "The operation was canceled", and we do not get more information about the error.

What can be the reason for the error?

I registered my application, with the "Onboarding Embed tool (https://app.powerbi.com/embedsetup)", with the "Embed for your organization" option, obtaining the clientId and the client secret (https://app.powerbi.com/embedsetup/UserOwnsData?session_id=bb51d392-241c-452b-9e0a-cb4ac91c8e6b).

 

Perhaps it is necessary to register the powerbi application in Azure, and the clientId and client Secret are not valid for other environments, such as development?

 

Thank you very much

 

 

2 REPLIES 2
Anonymous
Not applicable

Thank you very much for the reply!

 

Although I will review the points mentioned, I still have the doubt, why the token obtaining service, which is invoked with the url https://login.windows.net/common/oauth2/token, works from postman, it also works running the application .Net in Local, and it does not work when the application is deployed to a server, giving an error "System.OperationCanceledException", "The operation was canceled".

 

On the other hand, from the server itself, if it returns Token, if the url is called from Postman.


What explanation can you have

 

Perhaps a redirect url is needed, when deploying to a server?

v-yiruan-msft
Community Support
Community Support

Hi @Anonymous ,

You can refer the following links to embeded the content for the organization into your application...

Embed a Power BI report in an application for your organization

Step 1 - Configure your Azure AD app

When your web app calls Power BI, it needs an Azure AD token to call Power BI REST APIs and embed Power BI items such as reports, dashboards or tiles.

If you don't have an Azure AD app, create one using the instructions in Register an Azure AD application to use with Power BI.

To configure your Azure AD app, follow the instructions in Configure your Azure AD app.


Step 2 - Get the embedding parameter values
Step 3 - Add the required NuGet packages
Step 4 - Enable server-side authentication
Step 5 - Build your app's client side
Step 6 - Run your application

Embedded Power BI reports with ASP.NET Core

Embed Power BI Report for Organization using User Owns Data

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.