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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

GenerateToken for dashboard with links to reports in the same workspace

Hello -

I am able to generate token for dashboards that do not have any links embedded just fine, but with anything that has links I get the "InternalServer" error.

var token = new TokenCredentials(accessToken, "Bearer");
using (var client = new PowerBIClient(new Uri("https://api.powerbi.com"), token))
{
ODataResponseListDashboard dashboards = client.Dashboards.GetDashboardsInGroup(groupId);
GenerateTokenRequest request = new GenerateTokenRequest("view");
Dashboard dashboard = dashboards.Value.FirstOrDefault(a => a.DisplayName.Contains("Test"));
try
{
EmbedToken embedToken = client.Dashboards.GenerateTokenInGroup(groupId, dashboard.Id, request);
}
catch (Exception ex1)
{
}
}

Any help would be appreciated.

Thanks, Shilpi

5 REPLIES 5
Eric_Zhang
Microsoft Employee
Microsoft Employee


@Anonymous wrote:

Hello -

I am able to generate token for dashboards that do not have any links embedded just fine, but with anything that has links I get the "InternalServer" error.

var token = new TokenCredentials(accessToken, "Bearer");
using (var client = new PowerBIClient(new Uri("https://api.powerbi.com"), token))
{
ODataResponseListDashboard dashboards = client.Dashboards.GetDashboardsInGroup(groupId);
GenerateTokenRequest request = new GenerateTokenRequest("view");
Dashboard dashboard = dashboards.Value.FirstOrDefault(a => a.DisplayName.Contains("Test"));
try
{
EmbedToken embedToken = client.Dashboards.GenerateTokenInGroup(groupId, dashboard.Id, request);
}
catch (Exception ex1)
{
}
}

Any help would be appreciated.

Thanks, Shilpi


@Anonymous

The code works in my test, I don't get any error when trying to generate embed token for a dashboard with tiles having link to a report in the current workspace.

Capture.PNG

 

For those specific dashboards that lead to the internal server errors in your case, instead of the C# code, can you try to test the REST API GenerateToken with some test tool, like POSTMAN.

 

Anonymous
Not applicable

Thanks @Eric_Zhang, I will try that.

 

Are there any spcial permissions needed for those reports/dashboards?

 

Thanks, Shilpi

Anonymous
Not applicable

Also when I see the picture that you have attached, I realized that when you added the link to your report, the report appeared in the screenshot, where as I see this on my dashboard..

 

LinkedReport.PNG

Anonymous
Not applicable

And I cannot publish the report that I am adding to the dashboard to the web and get an embed code that way, because this report is not meant to be public.

Anonymous
Not applicable

Hello -

 

I am able to generate token for dashboards that do not have any links embedded just fine, but with anything that has links I get the "InternalServer" error.

 

var token = new TokenCredentials(accessToken, "Bearer");
using (var client = new PowerBIClient(new Uri("https://api.powerbi.com"), token))
{
ODataResponseListDashboard dashboards = client.Dashboards.GetDashboardsInGroup(groupId);

GenerateTokenRequest request = new GenerateTokenRequest("view");

Dashboard dashboard = dashboards.Value.FirstOrDefault(a => a.DisplayName.Contains("Test"));

try
{
EmbedToken embedToken = client.Dashboards.GenerateTokenInGroup(groupId, dashboard.Id, request);

}
catch (Exception ex1)
{
}

}

 

Any help would be appreciated.

 

Thanks, Shilpi

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.

Top Kudoed Authors