Do I need an Azure AD app to embed my Power BI reports in my own app? - reactjs

I'm confused about the guideline I have to follow to embed some Power BI reports in a react app. I've been reading this documentation but I don't understand why I need an Azure AD app. By now I've created four Power BI reports and I've published them to the web (making them public and accessible for everyone). So, I've got four PBI links to access them. But I want to create a web app (probably with React) to embed them all in one link.
I understand that Azure covers authentication features, but my app will only show information, doesn't need users to log in or something. So, I guess Azure helps to authenticate to the PBI account I'm using. But if this is the case, why PBI doesn't ask me for authentication when I share the reports links with anyone?
Thank you in advance!

You need Azure AD app to have identity for your application, to authenticate to Azure AD (using MSAL for example) and for using the Power BI REST APIs. Check the following article: https://learn.microsoft.com/en-us/power-bi/developer/embedded/register-app

Since you are already logged in you don't need to login to PowerBi again, There are two ways to embed your PowerBI reports,
Publish to web -> Does not require authentication (Public reports)
Embed with authentication -> Hyperlink and token based ( Requires Azure AD)
You can check more information here

Related

How does client credential flow work in Workload identity federation?

For my current ASP.NET Core MVC application I authenticate directly with a web app registered in Azure AD Portal. This provides me with an access token so on the backend of my web application I can use MS Graph with my users specific account (ie add files to their onedrive , email, etc). However, my organization also has Okta which a lot of applications authenticate against. So I was trying to determine to authenticate through Okta (which has a much cleaner sign in process IMO) as well as authenticate against Azure AD and get an access token. Through my research I found something in my web application registration in Azure AD called Workload Identity Federation. This led me to this useful video
https://www.youtube.com/watch?v=wZ0gCJYMUKI
and also microsofts info site:
https://learn.microsoft.com/en-us/azure/active-directory/develop/workload-identity-federation
This seems to answer what I want which is to use Okta but allow me to still use MS Graph for my users since it will authenticate against Azure AD (correct me if I am wrong and this is for something else). My issue is none of these resources really go into depth regarding how the access token is passed to my application so I can use MS Graph. My research this is called client credential flow since my application only has delegated permissions so it requires the users to log in and it basically allows my web app to act on their behalf when using MS Graph. So I am trying to understand and fill this void of information regarding how client credential flow fits into Workload Identity Federation and is this the solution to my problem.

Embed Power BI Report in a single page app for organisation users

I am trying to embed the Microsoft Power BI report into the react app. As per the documentation, for embedding and accessing the Power BI Rest APIs we need to register an Azure Active Directory App.
As we already have an Azure AD app that we are using for single sign-on I tried to add scope for report access. But I am not getting any success
I added "https://analysis.windows.net/powerbi/api/Report.Read.All" scope in my msal config but it's not working
Can't we use the same APP (Already used for SSO) for accessing POWER BI?
This is the article that I am following
https://learn.microsoft.com/en-us/power-bi/developer/embedded/embed-sample-for-your-organization?tabs=net-core
Thank you

Azure AD App Service Authorization for a Blazor App in Azure App Svc

I have a dotnet 5 Blazor Server-Side website deployed to Azure App Service. I've followed the tutorial at https://learn.microsoft.com/en-us/azure/app-service/scenario-secure-app-authentication-app-service to provide Authentication. Now, any attempt to reach my site requires a login from a user of the Azure AD.
Unfortunately, I haven't been able to find any guidance on how to manage Authorization though. For example, I'd like to restrict access to pages to members of specific groups within the Azure AD. I seem to remember years ago, there was some kind of membership provider database that the site would check.
The kind of thing I'm looking for is to be able to decorate the razor page with the name of an Azure AD group of which anyone attempting to load the page must be a member. Does anyone know of a link that describes the "official" way to achieve this?
Role-based access control (RBAC) a way to authorize applications based on the role permissions granted by the administrator to individual users/groups. Please refer this link for the detailed documentation on how to create/manage roles for an application in Azure AD.
Please refer this link for more details on how you can access the razor pages base on the roles assigned to the users/groups.

Office Add-In SSO with an AAD v1 app registration

I am developing a office add-in.
This office Add-In is supposed to retrieve the term store from SharePoint.
By following this tutorial:
https://learn.microsoft.com/en-us/office/dev/add-ins/develop/create-sso-office-add-ins-aspnet
I managed to get an access token to be used for Graph api. However the Graph does not expose any way of getting the term store. Is there a way we can generate an access token to be used with SharePoint and maintain the SSO?
It might be possible by registering an Azure AD v1 app but I could not find any documentation describing that.
I have a similar requirement, but in my research I wasn't able to find a good solution for this scenario.
I think it is probably possible to use a provider hosted SharePoint add-in. And then use the Authorization Code flow for obtaining an access token. Since the SharePoint add-in is trusted it will not require user login.
Of course this does mean the add-in needs to be deployed in SharePoint. If your Office add-in is distributed through the store this isn't really a great solution.
Hopefully there are other ways of achieving the same.
You could call SharePoint Online APIs (via REST or CSOM) with Azure Active Directory Apps. To call APIs secured by Azure AD, your app must acquire an access token from Azure Active Directory.
Please first refer to this document for integrating applications with Azure Active Directory. Then use Azure Active Directory Authentication Library (ADAL) to easily authenticate users to cloud or on-premises Active Directory (AD), and obtain access tokens for securing API calls.

Accessing Office Graph apis with Sharepoint Online login?

We've been running an Angular app in a custom masterpage during the last year, using the Sharepoint REST api to retrieve user properties, data from lists etc., which has been working fine. As the application is hosted on Sharepoint Online, accessing the page requires a login thus making the request digest available so further authentication is not necessary.
Now however, we want to start using some of the functionality in the Microsoft Graph API. From what I can gather this requires OAuth2 authentication against the Azure Active Directory, involving among other things a redirect to the AAD login page.
Does this mean I have to:
1) Login via the organizations (standard Microsoft) login page to access the Sharepoint Online site.
2) Redirect to the Azure AD login page and back again?
Or can I leverage the login that the user already did when logging into Sharepoint Online?
Sorry if the question is a bit vague, we are all still very new to this.
When registering your application on Azure AD you will give the app access to Files/Sharepoint REST api and Microsoft Graph API. See this picture the app has access to several apis (Exchange, Graph and AD) you must add sharepoint APIs in your case.
Regarding the authentication, I am afraid that the Sharepoint model does not provide a token that will enable you to request the Graph API see this. You will have two authentications, one to access the Sharepoint site, as you said, and the other "within" the sharepoint iframed add-in to log into your AAD's registered app. This will be an OAUTH process through login.microsoft.com. Have a look at my Outlook add-in Keluro Mail Team on the Office store, I think it is similar to what you want to achieve.
You can use the same token from graph.microsoft.com. I have a sample using Asp.Net Core 1.0 and the.Net ADAL but the same authentication flow is used when using ASP.NET 4.6. Just make your auth request against ms graph on startup then acquire access token to auth against SharePoint.
https://github.com/edrohler/com.ericrohler
Hope this helps.

Resources