Forum Discussion
400 Bad Request Error when embedding report
- Anonymous6 years ago
Hi shaw
If you are using the 'App owns data' type of embedding + using the Service Principal to generate embedding tokens, then this Identity section of the token request should contain details of the 'user' used for Row Level Security purposes.
Are you reports/dashboards using Row Level Security?
If so... your identity section should look like this..."identities": [ { "username": "[email protected]", "roles": [ "My PBI Role Name" ], "datasets": [ "cfafbeb1-8037-4d0c-896e-a46fb27ff229" ] } ]Username can be any value - you are effectively impersonating this person - and this has no link to any account in your Azure tenant or Power BI access list.
Roles should contain any Power BI (RLS) roles that you have defined inside your data model. Note that you should not supply roles here if you are not using RLS - and dont supply roles that dont exist in your model. Again, this is not a role that belongs to your Service Principal account or any other Power BI account type (admin/member/viewer) etc..Hope this helps,
Cheers - Matt
UPDATE: While testing the APIs, we identified the error "dataset or the user does not exist, set identify to the dataset".
After inserting the identities node to the requestHeader (as per the JSON below)
{
"datasets": [
{
"id": "cfafbeb1-8037-4d0c-896e-a46fb27ff229"
}
],
"reports": [
{
"id": "b2e49b01-2356-4456-bfb9-3f4c2bc4ddbd"
}
],
"identities": [
{
"username": "<AZURE APP ID GOES HERE>",
"roles": [
"Admin"
],
"datasets": [
"cfafbeb1-8037-4d0c-896e-a46fb27ff229"
]
}
]
}
The original issue I posted here is now resolved. So we are able to see the dashboard displayed on our web application.
Another issue still exists: Although the service principal is an admin and as an admin, this service principal has the full access to the workspace, the data is not loading on the embedded report. Only the report's layout is loading but not the actual dashboard.
So we tried to add identities for the report level with the role name to the above-mentioned JSON. Still, we haven't got any luck so far. I also checked to have the following permissions set on the azure app.
Hi shaw
If you are using the 'App owns data' type of embedding + using the Service Principal to generate embedding tokens, then this Identity section of the token request should contain details of the 'user' used for Row Level Security purposes.
Are you reports/dashboards using Row Level Security?
If so... your identity section should look like this...
"identities": [
{
"username": "[email protected]",
"roles": [
"My PBI Role Name"
],
"datasets": [
"cfafbeb1-8037-4d0c-896e-a46fb27ff229"
]
}
]
Username can be any value - you are effectively impersonating this person - and this has no link to any account in your Azure tenant or Power BI access list.
Roles should contain any Power BI (RLS) roles that you have defined inside your data model. Note that you should not supply roles here if you are not using RLS - and dont supply roles that dont exist in your model. Again, this is not a role that belongs to your Service Principal account or any other Power BI account type (admin/member/viewer) etc..
Hope this helps,
Cheers - Matt