Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Zed101
Frequent Visitor

Error: Generate token request for proxy model should include the core model ID

Trying to use RLS with PowerBi embedded analytics, when I tested a POST request to generate token:
POST https://api.powerbi.com/v1.0/myorg/GenerateToken

I'm receiving following error:

{ "error": { "code": "InvalidRequest", "message": "Generate token request for proxy model should include the core model ID" } }

This happens only in case when sending identities in request body for reports using direct query connection.

If it is expecting a "Core model Id" in such scenario, cannot understand what is core model Id and how to pass it in request body as request body doesn't mention anything like model or modelId.

For Request body structure, please see: 
https://learn.microsoft.com/en-us/rest/api/power-bi/embed-token/generate-token

1 ACCEPTED SOLUTION

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

View solution in original post

9 REPLIES 9
BooaB
Regular Visitor

Hi,

 

any updates on how to solve this? Where can we find the core model id?

 

regards,

 

PJ

Zed101
Frequent Visitor

Hi, 

No luck so far. The actual problem is how to pass modelId to the request. 
You can see modelId in browser while report is loading under Network tab:

Zed101_2-1681271949127.png

So you can find modelId through either conceptual schema or models&Exploration request.  


But, can't proceed any further.

BR

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

Zed101
Frequent Visitor

Just to add, core model refers to the upstream datasets
Also, when mentioning datasets under identities in request body, mentioning only the upstream dataset worked without mentioning the direct dataset report is referring to, because Effective identity required only on upsteam dataset in my case

jaweher899
Super User
Super User

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#generatetokenrequestv..., you'd see there is no mention of modelId there. Still I tried but didn't work.

Hi, did you find the solution for this one?

Yes. See BooaB solution in this page, dated 04-12-2023

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

anambedoya_0-1705942599901.png

 

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.