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
Merry
Regular Visitor

Operation returned an invalid status code 'Forbidden' when retrieving embed GenerateTokenAsync

Hi everyone,

 

Our reports in power bi embedded stopped working . It has been working and all of a sudden it give us the Forbidden status.

We are using service principal model. 

 

We I debug the code Power Bi Client if successful instantiated, I can even get the list of my respots in workspace how ever when it reaches to return await PowerBiClient.EmbedToken.GenerateTokenAsync(tokenRequest) it fails.

We checked the Audit log on Power Bi but we could not find anything valuable on there.

 

 

We have a Power BI Premuim  Licence and dedicated Capacity.

 

 

Any advice would be much apprecaited!

 

Thanks,

 

Maryam

 

 

 

 

 

 

2 ACCEPTED SOLUTIONS
Merry
Regular Visitor

Thank you for the information . It turned out that embedding Power BI reports on the tenant was disabled wrongly, 

View solution in original post

Thank you s o much! We found the issue. For some reason in Admin center under Tenant --> Developer  Setting --> Embed contenet in apps had been removed. Once we specified the security group the issue is resolved.

 

Thanks,

 

Maryam

View solution in original post

5 REPLIES 5
Ruchita
Helper I
Helper I

I was also facing the same issue. All the API permissions were correct and it was getting hard to find the problem. So I registered a new service principal in Azure and did not configure any permissions for the service principal. And embedded the new IDs in my web app, the error got resolved. It seems there were some issue in the previous service principal.

Merry
Regular Visitor

Thank you for the information . It turned out that embedding Power BI reports on the tenant was disabled wrongly, 

I have exact same issue also have dedicated embed capacity and still getting 403 to acquire Embed Token

v-rzhou-msft
Community Support
Community Support

Hi @Merry ,

 

 

how ever when it reaches to return await PowerBiClient.EmbedToken.GenerateTokenAsync(tokenRequest) it fails.

 

I think there should be something wrong in generate embed token. As far as I know, your service prinicpal will generate access token and then generate embed token to your customers. 

You may refer to this offical blog to learn more details about the workflow.

For refernece:

Authentication flows

Generate an embed token

I suggest you to have a test to generate access token and then generate embed token by bear token(access token) in Postman by Rest API.

Using Postman, we use below POST REST API with body information to get the Bearer Token

RicoZhou_0-1654502444654.png

To use this, we will need to configure the Body as below,

RicoZhou_1-1654502444659.png

Then generate embed token in Postman.

Embed Token - Generate Token

 

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.

 

             

Thank you s o much! We found the issue. For some reason in Admin center under Tenant --> Developer  Setting --> Embed contenet in apps had been removed. Once we specified the security group the issue is resolved.

 

Thanks,

 

Maryam

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.