Forum Discussion

umutgulac's avatar
umutgulac
Frequent Visitor
9 years ago

How to embed a PBI report into our web app where data is in SSAS

 

Under File directory, we couldnt find "Publish to Web" option. Is it because we prefered "online" connection option?

 

We try to get report from a web (php) application; as guided in this link: 

* We registered our app in Azure AD. We coded in our PHP webapp.

* We got the authorization code and acess token.

* We got the report list over PBI API with the response for report id and embed url.

 

We cannot fetch data from embed url. What may be the possible cause?

 

We also tried to test over here; but since we coulnt figure outthe embed code; we couldnt test over there? How to find the embed code?

1 Reply

  • Eric_Zhang's avatar
    Eric_Zhang
    Icon for Microsoft Employee rankMicrosoft Employee

    umutgulac wrote:

     

    Under File directory, we couldnt find "Publish to Web" option. Is it because we prefered "online" connection option?

     

    We try to get report from a web (php) application; as guided in this link: 

    * We registered our app in Azure AD. We coded in our PHP webapp.

    * We got the authorization code and acess token.

    * We got the report list over PBI API with the response for report id and embed url.

     

    We cannot fetch data from embed url. What may be the possible cause?

     

    We also tried to test over here; but since we coulnt figure outthe embed code; we couldnt test over there? How to find the embed code?


    umutgulac

    The here link is a demo of Power BI Javascript for Power BI Embedded. However you can still apply the Javascript API to embed the reports from Power BI Service in your case. Since you've figured out how to get the accesstoken and embed url, to embed a report with them, you can reference below html demo.

     

    <html>
    
     <script src="https://microsoft.github.io/PowerBI-JavaScript/demo/node_modules/jquery/dist/jquery.js"></script>
    
    <script src="https://microsoft.github.io/PowerBI-JavaScript/demo/node_modules/powerbi-client/dist/powerbi.js"></script>
     
    <script type="text/javascript">
    window.onload = function () {  
     
    
    var embedConfiguration = {
        type: 'report',
    	//replace your token here
        accessToken: 'eyJ0eXAiOiJKV1QiLCJhbGciOiJ.................BwzM733Q',
    	
    	//replace your reportid here
    	id: '057f230b-015e-4c86-ac98-55e82baf363a',
    	//replace your embedUrl here
        embedUrl: 'https://app.powerbi.com/reportEmbed?reportId=057f230b-015e-4c86-ac98-55e82baf363a' 
    
    }; 
     
    
    var $reportContainer = $('#reportContainer');
     
    var report = powerbi.embed($reportContainer.get(0), embedConfiguration);
     
    }
    </script>
    
    <div id="reportContainer" ></div>
    
    </html>