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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

Extend the expiration time of Power BI report embed token

Hi all,

 

I am trying power bi Embed and i am using rest api to generate the embed token. and getting Embed token with expiration time of 1 hr. 

Is there anyway that I can extend the Power BI report embed token expiration time?

Thank you

2 REPLIES 2
v-lid-msft
Community Support
Community Support

Hi @Anonymous ,

 

How about the result after you follow the suggestions mentioned in my original post?Could you please provide more details about it If it doesn't meet your requirement?


Best regards,

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-lid-msft
Community Support
Community Support

Hi @Anonymous ,

 

Based on my research, we can try to use the token lifetime policy and Assign policy to a service principal to configure the expiretime up to 24 hours, please refer to this document and thread: 

https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-configurable-token-lifetimes#example-token-lifetime-policies

https://community.powerbi.com/t5/Developer/Access-token-setting-expiration-times/td-p/215696


you can also keep the default expire time and generate a new token before expire to update. when generate an embedded token, it will return the expire time, then you can generate a new token before the expire time, please refer to the example code with javascript

https://github.com/microsoft/PowerBI-JavaScript/wiki/Update-Embed-Token

https://github.com/microsoft/PowerBI-JavaScript/wiki/Refresh-token-using-JavaScript-SDK-example

we did not find sample code by RESTful, but the logic should be similar.

 

Update:

 

following policy make the expire time up to 2 hours (token refreshed when 04:55 UTC+0)

 

$policy = New-AzureADPolicy -Definition @('{"TokenLifetimePolicy":{"Version":1,"AccessTokenLifetime":"02:00:00","MaxAgeSessionSingleFactor":"02:00:00"}}') -DisplayName "ApiDefaultPolicyScenario" -IsOrganizationDefault $false -Type "TokenLifetimePolicy"

 

11.jpg

 


Best regards,

 

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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