cancel
Showing results for 
Search instead for 
Did you mean: 
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
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

November Power BI Update 768x460.png

Check it Out!

Click here to read more about the November 2021 Updates!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.