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

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
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.