Forum Discussion
Error: Generate token request for proxy model should include the core model ID
- Anonymous3 years ago
Hi,
i was able to solve it.
a report is using at least one dataset (= proxy model). If that dataset is referring to other datasets (= core model) then these need to be mentioned all in the generate embeded token request.
eg
report1 -> dataset1 (proxy model) -> dataset2 (core model), dataset3 (core model)
then the request should contain dataset1 id, dataset2 id and dataset3 id.
these additional datasets (core models) should be added as a normal dataset (so a separate dataset object iso a modelid inside the existing one)
{ "accessLevel": "View", "allowSaveAs": "false", "datasetId": "<dataset ID>", "identities": [ ... ], "datasets": [ { "id": "<dataset1 ID>", ... },{ "id": "<dataset2 ID>", ... },{ "id": "<dataset3 ID>", ... } ] }Hope this helps
regards
The "Core model ID" mentioned in the error message is a required parameter for generating a token when using row-level security (RLS) with direct query connections in Power BI Embedded. This parameter refers to the ID of the semantic model that the report is based on.
To pass the Core model ID in the request body, you need to add a property called "datasets" to the JSON payload, which contains the list of datasets used in the report. For each dataset, you need to specify the dataset ID and the core model ID in the "id" and "modelId" properties, respectively.
Here's an example of how to modify the request body to include the Core model ID:
{
"accessLevel": "View",
"allowSaveAs": "false",
"datasetId": "<dataset ID>",
"identities": [ ... ],
"datasets": [
{
"id": "<dataset ID>",
"modelId": "<core model ID>"
}
]
}
Replace <dataset ID> with the ID of the dataset used in the report, and <core model ID> with the ID of the semantic model that the report is based on.
You can find the Core model ID by opening the report in Power BI Desktop and selecting "Modeling" from the ribbon. The Core model ID is displayed in the "Current File Properties" section.
I hope this helps!
I tried it, receiving same error.
I have only one dataset with xmlaPermissions set to ReadOnly, hence the request thus formed had a structure like below (Also, replaced all placeholders below with real values)
{
"accessLevel": "View",
"allowSaveAs": "false",
"datasetId": "<dataset ID>",
"identities": [
{
"username": "<userName>",
"roles": [
"Default"
],
"datasets": [
"<dataset ID>"
]
}
],
"datasets": [
{
"id": "<dataset ID>",
"modelId": "<core model ID>",
"xmlaPermissions": "ReadOnly"
}
]
}
I was able to find the modelId, however passing it into the request the way as suggested above didn't work for me. Also, if you could examine the request structure for datasets array inside from https://learn.microsoft.com/en-us/rest/api/power-bi/embed-token/generate-token#generatetokenrequestv2dataset, you'd see there is no mention of modelId there. Still I tried but didn't work.
- anambedoya2 years agoFrequent Visitor
Hi, did you find the solution for this one?
- Zed1012 years agoFrequent Visitor
Yes. See BooaB solution in this page, dated 04-12-2023
- anambedoya2 years agoFrequent Visitor
Hi Zed101 I'm trying to make this request work but I'm getting this error. I saw in BooaB response he adviced to put the model id into a different dataset object but when I do that, I get that the dataset doesn't exist. I'm confused in that part 'since the modelId I'm using is a numeric value as the one you showed previously in a screenshot