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
2022 Release Wave 1 760x460.png

2022 Release Wave 1 Plan

Power Platform release plan for the 2022 release wave 1 describes all new features releasing from April 2022 through September 2022.

Power BI December 2021 Update_carousel 768x460.jpg

Check it Out!

Click here to read more about the December 2021 Updates!

Jan 2022 Dev Camp 768x460 copy.png

Power BI Dev Camp- January 27th, 2022

Mark your calendars and join us for our next Power BI Dev Camp!