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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
Anonymous
Not applicable

Embedding reports using Azure Analysis Services

My team and I are attempting to embedd power bi reports in our angular app. Currently we have created a few reports connecting to Azure Analysis Services which, according to power bi service, are connecting correctly to the database and displaying the visuals as intended.

 

However when I try to get the data from one of those reports using power bi's api it returns an error 500 'BadRequest'; we are using an app owns data model with a service principal and it is able to return data and embed reports not using Analysis Services, we are also using RLS.

 

I can't figure out what we're missing. I assume that the gateways my collegues set up are working fine otherwise the report wouldn't load in power bi service, do we need to grant our service principal permissions or roles to use the database inside our Analysis Service? Is there some obscure function that I should be using to return data from these reports?

 

My code to return the report data is as follows

 

public async Task getReportEmbeddingData(string ws, string rep, string user) {

  PowerBIClient pbiClient = getPBIClient(); var report = await pbiClient.Reports.GetReportInGroupAsync(ws, rep);

  var embedUrl = report.EmbedUrl; var reportName = report.Name;

  GenerateTokenRequest genTokenReqParam = new GenerateTokenRequest(accessLevel: "Edit", allowSaveAs: true, identities: new         List { new EffectiveIdentity(username: user, roles: new List { "Manager" }, datasets: new List { *our dataset* }) });

  var embedding = await pbiClient.Reports.GenerateTokenInGroupAsync(ws, rep, genTokenReqParam);

  string embedToken = embedding.Token;

  System.DateTime tokenExpiration = embedding.Expiration??DateTime.Now;

  return new ReportEmbeddingData { type = "report", reportId = rep, reportName = reportName, embedUrl = embedUrl,                      accessToken = embedToken, expiration = tokenExpiration }; }

0 REPLIES 0

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.