1
votes

We implemented Power BI Embedded, App Owns Data following the documentation. We embed a report following the exact code in the App Owns Data github sample project. However we would like to extend the embedToken expiry time to multiple hours. We tried the following without success:

EmbedToken tokenResponse = await client.Reports.GenerateTokenInGroupAsync(pbi_groupId, report.Id, generateTokenRequestParameters);

DateTime expiration = DateTime.Now + TimeSpan.FromHours(10);

tokenResponse.Expiration = expiration;

But I believe the token is still expiring and the embedded report breaks after aprox one hour. Should this be working or should it be done in another way?

EDIT

After some research it seems like this could be done by changing the life for AccessTokens on Azure Active Directory which I understand defaults to 1h. If this is the case I'd appreciate instructions on how to do this on AAD, preferably via de Portal.

1

1 Answers

2
votes

I found a solution by configuring the access token life time in Azure Active Directory. I followed the steps in the documentation via PowerShell.

  • Downloaded Azure AD PowerShell module Public Preview.
  • Connect-AzureAD -Confirm with my azure subscription credentials to connect to my AAD organization account.
  • New-AzureADPolicy -Definition @('{"TokenLifetimePolicy":{"Version":1,"AccessTokenLifetime":"10:00:00"}}') -DisplayName "myNewPolicy" -IsOrganizationDefault $true -Type "TokenLifetimePolicy"

In my case it worked to make it organization default. The same access token requested for Power BI embedded has now a life of 10h.