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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.