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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Anonymous
Not applicable

This content isn't available after calling powered.embed($container, config)

Hello,

 

I am developing an application and am trying to embed Power Bi Premium, I have registeered the app as a Native Application, and used the ClientId to get the proper token.  I have confirmed that I can get the report EmbedConfig info I need to embed the report, including a ReportId, a EmbedUrl, accessToken, ect....

However, when I call the furntion to embed it seems to try to load for a minute, but then just says content isn't available.  The lines of code I am using to embed the report are....


var $reportContainer = $("#reportEmbed");
var report = powerbi.embed($reportContainer.get(0), self.embedConfig);

 

where....

 

embedConfig = {
accessToken: config.EmbedToken.token,
id: config.Id,
embedUrl: config.EmbedUrl

}

What I see in the debugging console is...

 

GET https://wabi-west-us-redirect.analysis.windows.net/metadata/cluster 403 (Forbidden) 

wabi-west-us-redirect.analysis.windows.net/metadata/cluster:1

 

I am now stumped on how to proceed to make my report show up.  Everything I find online about this is in regaurds to the old Power BI Embeded and not the new Premium option.  If anyone can help me understand what I am doing wrong, so that I can get reports to show up correctly, I would be much obliged.


Thanks,

 

Steven

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@Eric_Zhang

 

Thank you for your response. I was able to get this figured out this mornig.  It seems I was just missing a few properties of the config that you pass to the powerbi.embed function. Now my config looks like.....

 

self.embedConfig = {
type: 'report',
accessToken: config.EmbedToken.token,
tokenType: pbi.models.TokenType.Embed,
id: config.Id,
embedUrl: config.EmbedUrl,
permissions: pbi.models.Permissions.All,
settings: {
filterPaneEnabled: true,
navContentPaneEnabled: true
}
}
 
WIth the above properties set, the reports started showing up just fine. Thanks for all your help.
 
Stizz001

View solution in original post

2 REPLIES 2
Eric_Zhang
Employee
Employee

@Anonymous

Well, I don't see Embed token mentioned in your post, so guess that you may embed with the access token? The Embed token is generated specifically for individual reports/dashboards/tile with the accesstoken(See GenerateToken).  You can get the GenerateToken by calling the REST API or with Power BI API.

 

var tokenCredentials = new TokenCredentials(authenticationResult.AccessToken, "Bearer");

            // Create a Power BI Client object. It will be used to call Power BI APIs.
            using (var client = new PowerBIClient(new Uri(ApiUrl), tokenCredentials))
            {
                 
                // Get a list of reports.
                var reports = await client.Reports.GetReportsInGroupAsync(GroupId);

                // Get the first report in the group.
                var report = reports.Value.FirstOrDefault();

                if (report == null)
                {
                    return View(new EmbedConfig()
                    {
                        ErrorMessage = "Group has no reports."
                    });
                }

                // Generate Embed Token.
                var generateTokenRequestParameters = new GenerateTokenRequest(accessLevel: "view");
                var tokenResponse = await client.Reports.GenerateTokenInGroupAsync(GroupId, report.Id, generateTokenRequestParameters);

                if (tokenResponse == null)
                {
                    return View(new EmbedConfig()
                    {
                        ErrorMessage = "Failed to generate embed token."
                    });
                }

                // Generate Embed Configuration.
                var embedConfig = new EmbedConfig()
                {
                    EmbedToken = tokenResponse,
                    EmbedUrl = report.EmbedUrl,
                    Id = report.Id
                };

                return View(embedConfig);
            }

The embed token is a string starting with "H4sIAAAAAAAEA ....". A static html demo attached for your reference.

 

 

Anonymous
Not applicable

@Eric_Zhang

 

Thank you for your response. I was able to get this figured out this mornig.  It seems I was just missing a few properties of the config that you pass to the powerbi.embed function. Now my config looks like.....

 

self.embedConfig = {
type: 'report',
accessToken: config.EmbedToken.token,
tokenType: pbi.models.TokenType.Embed,
id: config.Id,
embedUrl: config.EmbedUrl,
permissions: pbi.models.Permissions.All,
settings: {
filterPaneEnabled: true,
navContentPaneEnabled: true
}
}
 
WIth the above properties set, the reports started showing up just fine. Thanks for all your help.
 
Stizz001

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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