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

Prepping for a Fabric certification exam? Join us for a live prep session with exam experts to learn how to pass the exam. Register now.

Reply
lherbert501
Post Patron
Post Patron

Embed API Sample error

Hi,

 

I'm trying to create a test embedded location and tried running the sample app from  Guy in a Cube.

 

I'm having a few problems and get this error when I try to run it. Does anybody know what that means?

 

Thanks in advance

 

lherbert501_0-1726073165049.png

 

Could somebody also kindly advise which username and role goes in below?

 

lherbert501_0-1726073944355.png

 

 

 

Code below

 

Thanks

 

guyinacube/Embed-API-Sample: A sample application to use the Power BI APIs for embedding. This makes...

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @lherbert501 ,

I tried to fix it myself, but it seems that this is because some of the content in the predefined configuration file before the code is outdated. If you want to modify it, you may not only need to modify the content in the screenshot, but also go back here to modify it:

vjunyantmsft_0-1726196723680.png

I'm not sure how the original author defined it, but I saw that this document was published 4 years ago:

vjunyantmsft_1-1726196863449.png


So it's very likely that some of the content is outdated. I think the best way is to find the original author and ask him to update it.

Best Regards,
Dino Tao
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

4 REPLIES 4
Anonymous
Not applicable

Hi @lherbert501 ,

About the first question, have you created a data source connection using one of the gateways to the semantic model of the report you need to embed? And have you change contents here?

vjunyantmsft_0-1726119674845.png

 

And about the second question, based on the screenshot you provided, it looks like you are trying to embed a report with RLS applied. So for the parameter Role, fill in the name of the RLS you created:

vjunyantmsft_1-1726105428848.png

As for the parameter username, it depends on whether you are implementing a static RLS or a dynamic RLS.
If it is a static RLS, then you can give it any string:

vjunyantmsft_2-1726105645709.png

But in the case of a dynamic RLS, the role of username is to pass a parameter value to your previously defined RLS role, so here you need to give username a specific string, i.e., what you want your RLS to be equal to.
You can refer to the following two documents, which explain it in more detail:
https://learn.microsoft.com/en-us/power-bi/developer/embedded/cloud-rls 
https://learn.microsoft.com/en-us/rest/api/power-bi/embed-token/generate-token#example-of-generating... 

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

Hi @Anonymous ,

 

Thankyou for your reply.

 

Could you please help me with the gateway aspect, as I think its the only thing left that's preventing it.

 

I have the gateway connection set up for the report that works fine and refreshes fine as below. Which bit do I change in the code?

 

lherbert501_0-1726136491592.png

 

I was unsure if the code below needed to stay commented out

lherbert501_0-1726138584589.png

 

 

 

Thanks

Anonymous
Not applicable

Hi @lherbert501 ,

I tried to fix it myself, but it seems that this is because some of the content in the predefined configuration file before the code is outdated. If you want to modify it, you may not only need to modify the content in the screenshot, but also go back here to modify it:

vjunyantmsft_0-1726196723680.png

I'm not sure how the original author defined it, but I saw that this document was published 4 years ago:

vjunyantmsft_1-1726196863449.png


So it's very likely that some of the content is outdated. I think the best way is to find the original author and ask him to update it.

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

Hi @Anonymous ,

 

Okay many thanks for looking into this for me 🙂

 

Liam

Helpful resources

Announcements
May PBI 25 Carousel

Power BI Monthly Update - May 2025

Check out the May 2025 Power BI update to learn about new features.

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

May 2025 Monthly Update

Fabric Community Update - May 2025

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