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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Power BI analytics embedding using Java APP

Hello, I have downloaded sample java for Power BI analytics embedding, and followed link instruction as per link 

(https://github.com/microsoft/PowerBI-Developer-Samples/blob/master/Java/Embed%20for%20your%20custome...

). 

 

But whnei run app from eclipse, am getting an 401 unauthorized error when EmbedController is trying to get access token.  

I have registered a App in Azure AD, genearted client secret and updated client id, secret , tenant id in config.java. I have also add permissions for Power BI Service ( delegated permission without admin consent). 

 

Can someone help why i am still getting 401 error.  

Please review the error below. 

rajeshkhatri_0-1621270757796.png

 

1 ACCEPTED SOLUTION
v-rzhou-msft
Community Support
Community Support

Hi @Anonymous 

From your screenshot, I found that you use app owns data to embed for customer.

Your issue should be caused by authentication failed.

When you use app owns data, you should select authentication method firstly.(Service principal or Master user)

Differences between Service principal or Master user:

1.png

Please check which authentication method you use in your embed. By different authentication method, you need to configure your App in different way, you need to configure your PBI Service in different way and you will need different parameter in your code.

Parameter you need:

2.png

If you use Master user you need to grant API permission in Azure portal.

If you use Service principal, please check blogs as below.

For reference about how to configure Service principal. After you configure your Service principal, you need to build a security group in Azure portal and add this Service principal into this group. Then you need to enable Service principal access in admin portal (add security group into it). And you need to add your app into the workspace as a member. (If you use matser user, you need to add your account into the workspace as a member or admin)

You can download visual studio and use this sample to have a test. If you run succeed to run this sample in visual studio, you can embed for your customer successfully.

For more details about how to embed for customer.

 

Best Regards,

Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. 

 

View solution in original post

1 REPLY 1
v-rzhou-msft
Community Support
Community Support

Hi @Anonymous 

From your screenshot, I found that you use app owns data to embed for customer.

Your issue should be caused by authentication failed.

When you use app owns data, you should select authentication method firstly.(Service principal or Master user)

Differences between Service principal or Master user:

1.png

Please check which authentication method you use in your embed. By different authentication method, you need to configure your App in different way, you need to configure your PBI Service in different way and you will need different parameter in your code.

Parameter you need:

2.png

If you use Master user you need to grant API permission in Azure portal.

If you use Service principal, please check blogs as below.

For reference about how to configure Service principal. After you configure your Service principal, you need to build a security group in Azure portal and add this Service principal into this group. Then you need to enable Service principal access in admin portal (add security group into it). And you need to add your app into the workspace as a member. (If you use matser user, you need to add your account into the workspace as a member or admin)

You can download visual studio and use this sample to have a test. If you run succeed to run this sample in visual studio, you can embed for your customer successfully.

For more details about how to embed for customer.

 

Best Regards,

Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors