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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
amassip
Helper I
Helper I

Power BI in ASP Net MVC

Hello,

 

I can display a RDL in an iframe from my own ReportServer  and now I would like to display a report (ASP MVC application) without Azure.

 

On this link https://github.com/Microsoft/PowerBI-JavaScript/wiki/Embedding-Basics

 

"but when using Power BI Embedded the tokens are issued by your own service and are specific to a report"

 

I understand that I don't need Azure but i need an accessToken to display the report...

 

Any idea ? Or Other way than PowerBI-JS ?

 

Thanks

2 ACCEPTED SOLUTIONS
runrunrun
Resolver I
Resolver I

Hi,

you can check this out.You can get the clientID & clientSecret from registering your app here

I tried and it worked 🙂

View solution in original post

AFAIK currently is not possible to hide filter panel or paging panel via REST API. Maybe we can upvote this :).

I tried using the same access token to embed report using powerbi.js, it didn't work. No console information, just blank screen

 

We can do it on powerbi.js though, see this link

Hope it helps

View solution in original post

13 REPLIES 13
amassip
Helper I
Helper I

@runrunrun

 

powerbi.js works, thanks 🙂

@amassip

 

PowerBI.js is awesome. However appending "&filterPaneEnabled=false" to a url still works when I test embeding with PowerBI REST API. It is just a little typo, try to drop the l in &filterPanelEnabled=falseSmiley Wink
Capture.PNG

Have someone try the filterpane=false and filter by report filters in SSRS 2016 on premise PowerBI reports?

amassip
Helper I
Helper I

Hello

 

I have a last question :

 

https://app.powerbi.com/reportEmbed?reportId=21b8b191-9313-4ad6-8a33-xxxx ==> works well

 

Now I want to hide the filter panel :

 

https://app.powerbi.com/reportEmbed?reportId=21b8b191-9313-4ad6-8a33-xxx&filterPanelEnabled=false

 

==> nothing happened, in the internet explorer's console I can see 'access denied'

 

Filters' level : on the page 

AFAIK currently is not possible to hide filter panel or paging panel via REST API. Maybe we can upvote this :).

I tried using the same access token to embed report using powerbi.js, it didn't work. No console information, just blank screen

 

We can do it on powerbi.js though, see this link

Hope it helps

amassip
Helper I
Helper I

@Eric_Zhang

 

For privacy reason I can't publish report but thanks for the suggestion !

 

@runrunrun

 

Thanks, with your second link and from this link I can get the AccessToken 😉

 

I connect to my PowerBI account ( AuthorizationCode) then I get the AccessToken and finally I want to display my reports

 

But I got an error on this line :

 

using (var response = request.GetResponse() as System.Net.HttpWebResponse)

Error 403 Forbidden.

 

 

On the register application power BI page I choose only Read All Reports

 

 

//Configure Reports request
            System.Net.WebRequest request = System.Net.WebRequest.Create(
                String.Format("https://api.powerbi.com/beta/myorg//Reports", 
                baseUri)) as System.Net.HttpWebRequest;

            request.Method = "GET";
            request.ContentLength = 0;
            request.Headers.Add("Authorization", String.Format("Bearer {0}", accessToken));

            //Get Reports response from request.GetResponse()
            using (var response = request.GetResponse() as System.Net.HttpWebResponse) // here

 

EDIT : problem solve, thanks all !

Hi I am having the same issue, can get a token, but getting a 403 when I submit.  What was your solution to get past the 403 in the Response?

Hello

 

How do you get your token ? From the authorizationcode ( with your powerBI account ) ?

 

I used this code to get a report :

 

 

string baseUri = "https://api.powerbi.com/v1.0/myorg/reports";
string token =  "token";
//Configure Reports request
System.Net.WebRequest request = System.Net.WebRequest.Create(
String.Format("{0}",
baseUri)) as System.Net.HttpWebRequest;
request.Method = "GET";
request.ContentLength = 0;
request.Headers.Add("Authorization", String.Format("Bearer {0}", token));

using (var response = request.GetResponse() as System.Net.HttpWebResponse)
{
    //do something..
}

 

Given that there was the SSRS's update in January 2017, we can display powerBI in SSRS ( such as RDL ) but is it possible to take this url to display a powerBI report,  i.e : in an iframe ? ( on-premise )

 

 

 

runrunrun
Resolver I
Resolver I

Hi,

you can check this out.You can get the clientID & clientSecret from registering your app here

I tried and it worked 🙂

amassip
Helper I
Helper I

@Eric_Zhang

 

I want to know if we can display a Power BI in a web app ( such as asp net ) but without Azure. I mean if there is a token that you acquired from the power BI authentification or something like that 

 

But I think it is not possible, you have to intregate Azure in your project.  

@amassip

Check if Publish to web from Power BI can meet your requirement. It is a public page and doesn't require any token.

Eric_Zhang
Microsoft Employee
Microsoft Employee

@amassip

 

I don't exactly understand what your mean "without azure". Both Power BI Service(at least Azure AD) or Power BI Embedded(Power BI workspace collection) are azure based.

Regarding getting an accessToken in Power BI Embedded, you can check DashboardController.cs in power-bi-embedded-integrate-report-into-web-app. You can explicitly specify when the token would expire, which means you can create a token never expires and use it anywhere in your javascript, though it is not recommended.

var embedToken = PowerBIToken.CreateReportEmbedToken(this.workspaceCollection, this.workspaceId, report.Id, Convert.ToDateTime("2017-12-31"));

 

eyalc
Power BI Team
Power BI Team

Power BI Embedded can be used only as a resource in Azure (you can read on it here)

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.