Forum Discussion
Power Bi REST API - 401 Authorization error when using app secret
- 7 years ago
Hi tripleacoder,
As far as I know, the permissions of Power BI are all based on the users. So an App can't act as a user. Please refer to developer/power-bi-permissions where all the descriptions have "user".
Regarding "Tenant.ReadWrite.All", the documentation above also has a description. Actually, these permissions only can retrieve the profiles rather than data. Please refer to admin/reports_getreportsasadmin.
One simple proof we can see is that even an admin can't access all the App workspaces. The data is the precious asset of a company. I think this is reasonable.
Best Regards,
Dale
Hi All,
I am also geeting the same error when accessing power BI rest API's. I am able to generate token but not proceeding further. Can you please paste your code, which ran successfully exclusive of all tennat id and username and pwd.
Thanks & Regards
tripleacoder wrote:I have a console app that uses the REST API to get a dataset (and later add rows to it). This works when I supply my own user/password credentials.
Now I have registered the app as a Web/API app in order to use an app key/secret instead. I can get a token, but when I make the same REST call I get 401 Unauthorized.
I have given the app the following Application permissions in Power BI Service (is this needed?):
Read and write all content in tenant
View all content in tenant
These permissions have been granted by an Azure Administrator.
In addition to the Delegated permissions that worked with user authentication:
Read and write all Datasets
View all Datasets
I have decode the two tokens.
The token for app key autentication contains this:
"roles": [
"Tenant.ReadWrite.All",
"Tenant.Read.All"
],
while the token for user based authentication contains this:
"scp": "Dataset.ReadWrite.All Workspace.ReadWrite.All",
What am I missing..?
tripleacoder wrote:I have a console app that uses the REST API to get a dataset (and later add rows to it). This works when I supply my own user/password credentials.
Now I have registered the app as a Web/API app in order to use an app key/secret instead. I can get a token, but when I make the same REST call I get 401 Unauthorized.
I have given the app the following Application permissions in Power BI Service (is this needed?):
Read and write all content in tenant
View all content in tenant
These permissions have been granted by an Azure Administrator.
In addition to the Delegated permissions that worked with user authentication:
Read and write all Datasets
View all Datasets
I have decode the two tokens.
The token for app key autentication contains this:
"roles": [
"Tenant.ReadWrite.All",
"Tenant.Read.All"
],
while the token for user based authentication contains this:
"scp": "Dataset.ReadWrite.All Workspace.ReadWrite.All",
What am I missing..?