Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
johlindr
New Member

PowerBI embedd on Salesforce using app owns data scenario

Hello,

 

We have successfully used the power bi embedd on salesforce witht the user owns data scenario, but are now trying to get this to function with app owns data scenario for a different use case.

 

However we fail to get the appropriate apex code to do the authentciation part for this scenario, anyone has any usable code examples or suggestions how to get this to work ?  There doesnt seem to be any ready libs to use for this.

 

Any help would be appreciated

6 REPLIES 6
amohammadi
Regular Visitor

Does Salesforce App-Owns-Data embedding require Power BI embedded License? What are the licensing requirements for Salesforce Salesforce App-Owns-Data embedding?

TerenceL
Frequent Visitor

HI @johlindr 

Do you managed to have your PBI embedded into Salesforce page in app owns data scenario?

If yes, could you please share your steps?

Thanks,

Terence

johlindr
New Member

Hello,

 

We are trying to get the App Owns Data scenario to work with PBI embedd on Salesforce but we fail to get the apex code to do the authentication properly. We have tried the user owns data scenario successfully, but we need the other scenario for another use case.

 

Has anyone got this to work with salesforce successfully, also if you can it would be really helpful with some example code as the apex does not seem to have any libraries available for the AAD authentciation flow.

 

Any help would be appreciated

v-ljerr-msft
Microsoft Employee
Microsoft Employee

Hi @johlindr,

 

Could you recheck the steps in this documentation to prepare your environment first, and then follow this documentation(including the sample code there) to embed the content into your own application(app owns data)? Smiley Happy

 

Regards

Thanks for your reply. As mentioned we have it working for the first scenario User owns data, and we have all the backend things on BI and AAD side in place. It is however the below part that is the core issue (copy paste the .net example), I have no issue running this example in a .net app however the problem is how to implement the AAD Client and do non-interactive authentication using username+password from APEX code. Or is there another option for authenticating the service user? 

 

using Microsoft.IdentityModel.Clients.ActiveDirectory; // Create a user password cradentials.

 

var credential = new UserPasswordCredential(Username, Password); // Authenticate using created credentials var authenticationContext = new AuthenticationContext(AuthorityUrl); var authenticationResult = await authenticationContext.AcquireTokenAsync(ResourceUrl, ClientId, credential);

if (authenticationResult == null) {

return View(new EmbedConfig() { ErrorMessage = "Authentication Failed." }); }

 

var tokenCredentials = new TokenCredentials(authenticationResult.AccessToken, "Bearer");

Hi Johlindr,

 

Did you manage successfully the scenario Access token for non-Power BI users  ( app owns data) ?

 

Many thanks for your answer.

Nuno.

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.