Thank you. I finally found a solution.
I´m not using the powerbi-javascript-library anymore, regarding of the issue that it is not possible to set the groupid of a report at the moment.
Instead i use the following javascript-code (based on the provided example).
<script>
function loadReportIntoIframe(reportId,groupId,iframeId){
var iframe = document.getElementById(iframeId);
var iframeUrl = 'https://app.powerbi.com/reportEmbed?reportId='+reportId;
if (groupId){
iframeUrl = iframeUrl + '&groupId=' + groupId;
}
iframe.src=iframeUrl;
iframe.onload = postActionLoadReport;
}
// Post the access token to the IFrame
function postActionLoadReport() {
// Construct the push message structure
// this structure also supports setting the reportId, groupId, height, and width.
// when using a report in a group, you must provide the groupId on the iFrame SRC
var m = {
action: "loadReport",
accessToken: 'YOUR_AAD_ACCESSKEY'
};
message = JSON.stringify(m);
// push the message.
iframe = document.getElementById('iFrameEmbedReport');
iframe.contentWindow.postMessage(message, "*");;
}
</script>Sample:
Loading a report from your worksspace:
<a href="javascript:loadReportIntoIframe('REPORT_ID','','IFRAME_ID')" >REPORT NAME</a>Loading a report from group:
<a href="javascript:loadReportIntoIframe('REPORT_ID','GROUP_ID','IFRAME_ID')" >REPORT_NAME</a>Next i will try to do the same with powerbi dashboards ...