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
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
Thanks .. I was using RLS and this post helped solve the issue while moving to service principle. username/pass seems to work fine with RLS enabled on a report even if you don't send the roles/username in the JSON, where as service principle requires it.