Embedding Power BI reports in to Angular application - powerbi

I am trying to embed a Power BI reports in to our Angular application. We are currently using Identity server to authenticate and get the security token back from Azure Active Directory. Can that token be used in embedding the Power BI reports in to our application or is it mandatory to register a application in azure which will help in embedding reports

You must register an application to establish an identity for your application and specify permissions. Both the access token and the app ID are used when embedding Power BI elements into your application. It is recommended for the actual embedding to also use embed token generated by GenerateTokenInGroup or similar, because the authentication token will be exposed in JavaScript client code of your application and can be seen. AAD tokens can be exploited to call other REST API functions, etc., while embed tokens are valid only for embedding this one element only and expires in less time.
For detailed information how to embed Power BI see Embed reports or dashboards from apps.
To embed Power BI without registering an application, you can use Publish to web or Embed. The first one will give public access to everyone who knows the link (note it has some limitations), while for the second option each user will need Pro account, unless you are using Power BI Premium or Embedded (and note its limitations too).

Related

Power BI - Registering an application and granting permission

I am stuck getting power bi embedded working. I keep reading that I need to register an application in Azure/Power BI.
I have an existing web application. Does that mean I can skip this step of creating one? https://app.powerbi.com/embedsetup/AppOwnsData
note: I'm trying to set this up with AppOwnsData, masteruser.
Is this where I add appropriate permisions if adding to an existing one?
and if I am adding permissions to this existing azure app, then does my user need permission to sign in to this particular app or just power bi?
To generate an embedding token for Power BI your application code must first get an access token for Power BI, and to do this you must use the ApplicationId of an application registered in Azure Active Directory.
Tutorial: Embed Power BI content using a sample embed for your customers'
application Step 2 - Register an Azure AD application
You can use an existing AAD Application, but the online wizard creates a new one for you with the appropriate permissions to create a new (additional) AAD App just for Power BI Authentication.
The required permissions are documented here, although you should at least test with the wizard-created application first.

Connect Web API as a data source to power bi using authentication

I have azure web api app with number of web apis of type post/get to get data. these apis are having basic authentication (bearer token)
I want to use 2-3 APIs as a data source in power bi, so that I can use these APIs JSON response as a table.
In Power BI Desttop > Get Data > Web > add API URL with sample GET API method name, will work but then it is asking for authentication.
If I tried to put API Key, then it is saying: A web API key can only be specified when a web API key name is provided.
How to connect web api using authentication in power bi as a data source.
PowerBI web seems to currently have little or no support for connecting to data via webapi, or web queries generally.
PowerBI Desktop allows you to get data from the web. I have been able to access data from webapis managed by Azure API Management in two different ways:
Use Advanced rather than Basic in the From Web dialog box. Put the webapi query in the url, but add a header with name Ocp-Apim-Subscription-Key and put in as value the value of the api key.
Alternatively, instead of putting the api key in the header, with APIs managed by Azure API management, it seems you can add them to as a parameter to the apiquery, subscription-key=PutYourApiKey here.
However, I have found that although you can publish your data source or report to an online workspace, PowerBI online will give an error ("credentials not recognized" or similar) when you try and refresh the data! So as mentioned above, PowerBI online seems currently (Nov 2020) useless for connecting to WebApi data.

How to remove the signin page from the report when Power BI report is embedded into Web Application using Secure Embed Option

I have a web application in which Azure Active Directory authentication is implemented.
Now I am embedded my Power BI reports in this Web Application using Secure Embed Option.
Whenever a user logs into the web application, he sees a separate sign in button on the Power BI reports after successful login into Web Application.
Is there a way to automatically signin into Power BI reports using the currently logged in user.
Currently logged in user has access to both Azure AD as well as Power BI.
Secure embed option is used to embed a report in a given iframe where every user would need to sign-in within the iframe.
In order to provide a single sign-on experience, you would need to use the user login authentication to generate an access token.
Generating access tokens -
C# - https://learn.microsoft.com/en-us/power-bi/developer/get-azuread-access-token
JS - (Using ADAL) https://github.com/AzureAD/azure-activedirectory-library-for-js
This access token can then be used to embed reports within an HTML container (for example, a div element) using the Power BI embedded JS library.
When the token is created as per the different users logging in, then such implementation is called as 'User Owns Data'.
Sample code and summary - https://learn.microsoft.com/en-us/power-bi/developer/embed-sample-for-your-organization
Embed setup tool for user owns data: https://app.powerbi.com/embedsetup/UserOwnsData

Azure portal's active directory app integration with power bi content

I have created an native app enabling powerbi service permissions in azure portal going through azure active directory -> app registration. Now I want to create power bi reports, workspace on that created app but if I go to https://app.powerbi.com I can't see that created app on my power bi app.
I am confused here actually how to add power bi reports under that app because I want to access power bi rest api using adal.js lib where I need app id and want to access reports under that app.
Anybody can clear my confusion here?
Your confusion is with the terms "Apps" in Power BI. The app you registered has nothing in common with these. It is a guid, used from Power BI to identify your native app.
When you create a native app, you register it (what you did) and Power BI REST API uses this appID (also called ClientID) to identify your app and the permissions it has. When you call the API, you need an access token. It will be acquired in the context of some user. This user must have rights for the reports you want to access. So simply make a workspace, grant rights to users and publish your reports there. Then you will be able to embed them in your app.

How to get power bi dashboard in our own application?

I am new to power bi. I have power bi account there I created some dashboards with some reports, now I want to consume those dashboard and report using power bi rest API (https://learn.microsoft.com/en-us/rest/api/power-bi/)in our own application. Our application we used the .net core for back-end and angular 6 for the front end. We need to call power bi API from the .net core. If I change report in power it should also reflect in our application. I am new so I am not understanding from where to start?
Start by reading these:
Embedding with Power BI
Tutorial: Embed a Power BI report, dashboard, or tile into an application for your customers
Microsoft Power BI Embedded Playground
In essence, you need to authenticate using Azure Active Directory Authentication Libraries (ADAL), obtain the embedUrl of the dashboard, it's id and the id of the group in which it is. It will be loaded in a div section of a html file using the embedded client. For more details look at the official samples. App Owns Data means that for authenticating you are using one account, which your application knows (e.g. user name and password stored in the configuration), while User Owns Data means that each user uses his own Power BI credentials to access the embedded elements.