<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Power BI Embed report JavaScript in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Power-BI-Embed-report-JavaScript/m-p/1086787#M23635</link>
    <description>&lt;P&gt;How to apply trend line on existing report embed using power bi client api or authoring client api? is there js client methods available to do that? please provide pointers&lt;/P&gt;</description>
    <pubDate>Tue, 12 May 2020 22:30:47 GMT</pubDate>
    <dc:creator>NavasMS</dc:creator>
    <dc:date>2020-05-12T22:30:47Z</dc:date>
    <item>
      <title>Power BI Embed report JavaScript</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Power-BI-Embed-report-JavaScript/m-p/228938#M7238</link>
      <description>&lt;P&gt;How to Embed Power BI Reports for my Own Application so that non-bi users can access it. Apart from using by&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;Iframe&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;i&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;want to use Rest API.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am Stuck how to generate this token and how to get this. &amp;nbsp;&lt;/P&gt;&lt;P&gt;I have Referred&amp;nbsp;this Project &amp;nbsp;&lt;A href="https://microsoft.github.io/PowerBI-JavaScript/demo/v2-demo/index.html" target="_blank"&gt;https://microsoft.github.io/PowerBI-JavaScript/demo/v2-demo/index.html&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;to testing.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A title="Project  " href="https://microsoft.github.io/PowerBI-JavaScript/demo/v2-demo/index.html" target="_self"&gt;https://microsoft.github.io/PowerBI-JavaScript/demo/v2-demo/index.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In This,&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;i&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;want to know how can I get from my Power BI Report.&amp;nbsp;I have created some sample Reports and want it to show for my own application for&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;non- BI user&amp;nbsp;&lt;/P&gt;&lt;P&gt;1.&amp;nbsp;&lt;SPAN&gt;Embed Token&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;2.&amp;nbsp;Embed URL&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;3. report&amp;nbsp;id&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I have already registered&amp;nbsp;by application in&amp;nbsp;&lt;A href="https://dev.powerbi.com/apps" target="_blank"&gt;https://dev.powerbi.com/apps&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;made an account in Azure Portal but can't get&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Please Provide Step by Step with images if can be&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="issue.png" style="width: 600px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/54134i8B66710DE95483A2/image-size/large?v=v2&amp;amp;px=999" role="button" title="issue.png" alt="issue.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Aug 2017 07:16:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Power-BI-Embed-report-JavaScript/m-p/228938#M7238</guid>
      <dc:creator>rahulpower</dc:creator>
      <dc:date>2017-08-10T07:16:32Z</dc:date>
    </item>
    <item>
      <title>Re: Power BI Embed report JavaScript</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Power-BI-Embed-report-JavaScript/m-p/229771#M7239</link>
      <description>&lt;P&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/38708"&gt;@rahulpower&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;The process for embedding for non power bi users are all in this demo &lt;A href="https://github.com/Microsoft/PowerBI-Developer-Samples/tree/master/App%20Owns%20Data/PowerBIEmbedded_AppOwnsData" target="_self"&gt;App Owns Data&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;To get the Embedded Token, Embed URL and report id, the first step is to get an accesstoken, see code snippet from this &lt;A href="https://github.com/Microsoft/PowerBI-Developer-Samples/blob/9e53cef82b6834ddcfd12f2bc38b51e672bca6d7/App%20Owns%20Data/PowerBIEmbedded_AppOwnsData/Controllers/HomeController.cs" target="_self"&gt;HomeController.cs&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;            var credential = new UserPasswordCredential(Username, Password);

            // Authenticate using created credentials
            var authenticationContext = new AuthenticationContext(AuthorityUrl);
            var authenticationResult = await authenticationContext.AcquireTokenAsync(ResourceUrl, ClientId, credential);&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And then&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;// 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.&lt;FONT size="5"&gt;&lt;STRONG&gt;GenerateTokenInGroupAsync&lt;/STRONG&gt;&lt;/FONT&gt;(GroupId, report.Id, generateTokenRequestParameters);

                if (tokenResponse == null)
                {
                    return View(new EmbedConfig()
                    {
                        ErrorMessage = "Failed to generate embed token."
                    });
                }

                // Generate Embed Configuration.
                var embedConfig = new EmbedConfig()
                {
                    &lt;FONT size="5"&gt;EmbedToken = tokenResponse,
                    EmbedUrl = report.EmbedUrl,
                    Id = report.Id&lt;/FONT&gt;
                };&lt;/PRE&gt;
&lt;P&gt;Actually, underlying the code calls those POWER BI REST APIs &lt;A href="https://msdn.microsoft.com/en-us/library/mt634543.aspx" target="_self"&gt;Get Reports&lt;/A&gt;&amp;nbsp;and&amp;nbsp;&lt;A href="https://msdn.microsoft.com/en-us/library/mt784614.aspx" target="_self"&gt;GenerateToken&lt;/A&gt; .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Aug 2017 07:10:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Power-BI-Embed-report-JavaScript/m-p/229771#M7239</guid>
      <dc:creator>Eric_Zhang</dc:creator>
      <dc:date>2017-08-11T07:10:35Z</dc:date>
    </item>
    <item>
      <title>Re: Power BI Embed report JavaScript</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Power-BI-Embed-report-JavaScript/m-p/229810#M7242</link>
      <description>&lt;P&gt;Thanks a lot. Need to Be Done in Javascript can you Give me the steps or help out how to create azure and all the thinks&amp;nbsp;by step by step&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks once again&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Aug 2017 08:01:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Power-BI-Embed-report-JavaScript/m-p/229810#M7242</guid>
      <dc:creator>rahulpower</dc:creator>
      <dc:date>2017-08-11T08:01:28Z</dc:date>
    </item>
    <item>
      <title>Re: Power BI Embed report JavaScript</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Power-BI-Embed-report-JavaScript/m-p/230655#M7268</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;You can find all the steps needed to setup the enviroment and start embedding,&lt;BR /&gt;in this link- &lt;A href="https://powerbi.microsoft.com/en-us/documentation/powerbi-developer-embedding/" target="_blank"&gt;https://powerbi.microsoft.com/en-us/documentation/powerbi-developer-embedding/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Aug 2017 07:58:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Power-BI-Embed-report-JavaScript/m-p/230655#M7268</guid>
      <dc:creator>nimrod</dc:creator>
      <dc:date>2017-08-14T07:58:38Z</dc:date>
    </item>
    <item>
      <title>Re: Power BI Embed report JavaScript</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Power-BI-Embed-report-JavaScript/m-p/261278#M8050</link>
      <description>&lt;P&gt;Would a PowerBI Pro Trial version work?&lt;/P&gt;&lt;P&gt;Office 365 displays my Power BI account as Free.&lt;/P&gt;</description>
      <pubDate>Fri, 29 Sep 2017 02:49:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Power-BI-Embed-report-JavaScript/m-p/261278#M8050</guid>
      <dc:creator>Ashley1022</dc:creator>
      <dc:date>2017-09-29T02:49:40Z</dc:date>
    </item>
    <item>
      <title>Re: Power BI Embed report JavaScript</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Power-BI-Embed-report-JavaScript/m-p/301558#M8861</link>
      <description>&lt;P&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/6971"&gt;@Eric_Zhang&lt;/a&gt;&amp;nbsp;I have been folowing these article&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://powerbi.microsoft.com/en-us/documentation/powerbi-developer-get-azuread-access-token/" target="_blank"&gt;https://powerbi.microsoft.com/en-us/documentation/powerbi-developer-get-azuread-access-token/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Access token for non-Power BI users (app owns data)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and have patterned my web app's Controller.cs to get an Embed Token.. unfortunately, I am stuck with an exception that I am not sure what the root cause is.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What has been so far:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. An AAD user with Power BI Pro License&lt;/P&gt;&lt;P&gt;2. App workspace with 1 dashboard uploaded - connected to our CUBE hosted in Azure Analysis Services server&lt;/P&gt;&lt;P&gt;3. Registered my web-app into Azure AAD, assigned permissions into both Power BI service and AAD&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am able to login to AAD using the ClientID and ClientSecret:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;var clientId = ""; // took out actual value
var clientSecret = ""; // took out actual value
var authContext = new AuthenticationContext("https://login.windows.net/common/oauth2/authorize/");
var credential = new ClientCredential(clientId, clientSecret);
var authRes = (AuthenticationResult)authContext.AcquireTokenAsync("https://analysis.windows.net/powerbi/api", credential).Result;

var aadToken = authRes.AccessToken; // all good!

// get Embed Token for app workspace dashboard identified by groupId and dashboardId
var&amp;nbsp;groupId = ""; // took out actual value
var&amp;nbsp;dashboardId = ""; // took out actual value

var tokenCredentials = new TokenCredentials(aadToken&amp;nbsp;, "Bearer");
using (var client = new PowerBIClient(new Uri("https://api.powerbi.com/"), tokenCredentials))
{
var generateTokenRequestParameters = new GenerateTokenRequest(accessLevel: "view");
&lt;BR /&gt;// GenerateTokenInGroup is throwing exception: &lt;EM&gt;&lt;STRONG&gt;Operation returned an invalid status code 'Forbidden'&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;var tokenResponse = client.Dashboards.&lt;STRONG&gt;GenerateTokenInGroup&lt;/STRONG&gt;(groupId, dashboardId, generateTokenRequestParameters);

// Generate Embed Configuration.
var embedConfig = new
{
EmbedToken = tokenResponse,
EmbedUrl = "",
Id = dashboardId
};

}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First difference I can note of between the sample and my implementation is I am not using the Async version of the method. I am using&amp;nbsp;GenerateTokenInGroup instead of&amp;nbsp;GenerateTokenInGroupAsync. Is it required to use&amp;nbsp;GenerateTokenInGroupAsync ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I haven't setup anything in Power BI Premium or that one where we need to assign capacity, I don't think that's required in development stage.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What am I missing?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Nov 2017 03:00:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Power-BI-Embed-report-JavaScript/m-p/301558#M8861</guid>
      <dc:creator>Junilo</dc:creator>
      <dc:date>2017-11-13T03:00:21Z</dc:date>
    </item>
    <item>
      <title>Re: Power BI Embed report JavaScript</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Power-BI-Embed-report-JavaScript/m-p/1086787#M23635</link>
      <description>&lt;P&gt;How to apply trend line on existing report embed using power bi client api or authoring client api? is there js client methods available to do that? please provide pointers&lt;/P&gt;</description>
      <pubDate>Tue, 12 May 2020 22:30:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Power-BI-Embed-report-JavaScript/m-p/1086787#M23635</guid>
      <dc:creator>NavasMS</dc:creator>
      <dc:date>2020-05-12T22:30:47Z</dc:date>
    </item>
  </channel>
</rss>

