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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
simonlxd
New Member

Embed for your customers can not get emmbed token sometimes later

Hi All,

 

I ran into a very strange problem, I‘ve registered an application (service principal) on Azure, set PBI permissions, get Application ID and tenant ID and applicationSecret, I used this service principal to generate an AAD token, and then take this AAD token to request the PBI embed token, currently work, but after a period of time, the AAD token request PBI embed token cannot be obtained, I need to register a new one(APP Register) on Azure, and then take this new service principal to request that can work again, what is the problem? Is the AAD token expired. Thanks.

My code is C# code, refer to the following project:

https://github.com/microsoft/PowerBI-Developer-Samples/blob/master/.NET%20Framework/Embed%20for%20yo...

 

具体代码如下截图:

 

simonlxd_0-1687240520632.png

 

1 ACCEPTED SOLUTION
AmosHersch
Microsoft Employee
Microsoft Employee

Hi @simonlxd ,

 

AAD token does have expiration (default is 1h). Do you renew it before calling the Power BI API?

What is the error you're getting when the request to generate an embed token fails? Did you check if the response body contains information regarding the reason of the failure?

View solution in original post

3 REPLIES 3
simonlxd
New Member

Hi @AmosHersch 

Thanks for your response. Based on your idea, I checked it again. I found that trial AAD  token generate is limited. 

https://learn.microsoft.com/en-us/power-bi/developer/embedded/move-to-production

it says: "The number of embed trial tokens a Power BI service principal or master user (master account) can generate is limited." BTW, if i always create new service principal  to generate embed token when it limited, is that work? 😂

I don't know if the limit of free tokens is per user or per tenant.

AFAIU customers are expected to use trial tokens when testing their embedded solution, and later when moving to production purchase dedicated capacity so they will get unlimited number of tokens.

AmosHersch
Microsoft Employee
Microsoft Employee

Hi @simonlxd ,

 

AAD token does have expiration (default is 1h). Do you renew it before calling the Power BI API?

What is the error you're getting when the request to generate an embed token fails? Did you check if the response body contains information regarding the reason of the failure?

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors