cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
SeSPowerBi
Regular Visitor

DmtsDataSource: DiscoverMonikers did not return an access token for DataSource

Hello all,

Our current solution embeds Powerbi reports in the app. The reports and dashboards work but the paginated reports are creating an error. The application uses App Owns Data, Service Principal method for Power BI. The registered Power BI App is an admin of the workspace in the Power BI Service. 

 

I confirm that the report id given is accessible within the given workspace. Then, I provide the generateTokenRequestParameters as new GenerateTokenRequest(accessLevel: "view") since there is no RLS being applied. The tokenResponse is then generated using that generateTokenRequestParameters and the confirmed report and workspace id's. That confirmed report is then used for the embed url. 

if (biResourceType.Equals("rdl", StringComparison.InvariantCultureIgnoreCase))
{
var generateTokenRequestParameters = new GenerateTokenRequest(accessLevel: "view");

//CHECKING REPORTS AVAILABLE FOR WORKSPACE
var reports = await pbiClient.Reports.GetReportsInGroupAsync(workspaceId);
// No reports retrieved for the given workspace.
if (reports == null || reports.Value == null || reports.Value.Count() == 0)
{
Console.WriteLine("No reports were found in the workspace");

}

Report report;

if (string.IsNullOrWhiteSpace(resourceId.ToString()))
{
// Get the first report in the workspace.
report = reports.Value.FirstOrDefault();
}
else
{
report = reports.Value.FirstOrDefault(r => r.Id.ToString().Equals(resourceId.ToString(), StringComparison.InvariantCultureIgnoreCase));
}

if (report == null)
{
Console.WriteLine("No report with the given ID was found in the workspace. Make sure ReportId is valid.");
}

var tokenResponse = await pbiClient.Reports.GenerateTokenInGroupAsync(workspaceId, report.Id, generateTokenRequestParameters);

result.Id = report.Id;
result.EmbedUrl = $"{report.EmbedUrl}{(string.IsNullOrWhiteSpace(#####) || ##### == "undefined" ? "" : $"&rp:RelationshipA=#######&rp:RelationshipB=######&rdl:format=PDF")}";
result.AccessToken = tokenResponse.Token;

}


So, once that is all retrieved and sent from serverside to clientside for embedding, an error is recieved in power bi embedded element "DmtsDataSource: DiscoverMonikers did not return an access token for DataSource: '#####', DataSourceType: PBIDATASET, CredentialType: SingleSignOn". Fiddler provided the following additional information on the error " We couldn't find the page you were looking for. TECHNICAL DETAILS=An unknown error occurred".

 

Embedding App Client-Side Config object for powerbi-client library provided by Microsoft.

{
"type": "report",
"tokenType": 1,
"embedUrl": "https://app.powerbi.com/rdlEmbed?reportId=######&rp:RelationshipA=#####&rp:RelationshipB=#####&rdl:format=PDF",
"accessToken": "H4###...###==",
"permissions": 7,
"settings": {
"filterPaneEnabled": true,
"navContentPaneEnabled": true,
"localeSettings": {
"language": "en",
"formatLocale": "en"
}
},
"id": "######"
}


The paginated report does exist and is published in the Power BI Service. 

Why is this error occurring?

 

@PowerBI @paginated @rdl

2 REPLIES 2
v-lionel-msft
Community Support
Community Support

Hi @SeSPowerBi ,

 

Embed paginated reports in your Power BI embedded analytics application for your customers - Power B...

Embed Power BI paginated reports in your Power BI embedded analytics application - Power BI | Micros...

Did you refer to these two documents?

 

Best regards,
Lionel Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

@v-lionel-msft Thank you for your reply.

I have checked these resources and made sure that these steps were followed.

Our reports and dashboards are working with Power BI so I do not think that this error pertains to setup.

It is only the paginated reports that are producing this error and not embedding.

Helpful resources

Announcements
PBI User Groups

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are You Ready?

Test your skills now with the Cloud Skills Challenge.

Top Solution Authors