Forum Discussion
Push Datasets to PBI via multi tenant azure application with oauth2 auth 403 forbidden
I am developing a web application in which i want to allow users to push their data from the application to a power bi dataset (e.g. on their power bi work account).
Therefore i did the following:
I registered an azure ad application (Accounts in any organizational directory (Any Azure AD directory - Multitenant).
For authentication, i redirect a user to https://login.microsoftonline.com/common/oauth2/v2.0/authorize and add the corresponding redirect_uri, scopes, client_id, prompt=consent and response_type=code to the URL.
The scopes are:
- offline_access
- https://analysis.windows.net/powerbi/api/Dataset.Read.All
- https://analysis.windows.net/powerbi/api/Dataset.ReadWrite.All
- https://analysis.windows.net/powerbi/api/Workspace.Read.All
- https://analysis.windows.net/powerbi/api/Workspace.ReadWrite.All
scope:""https://analysis.windows.net/powerbi/api/Dataset.Read.All https://analysis.windows.net/powerbi/api/Dataset.ReadWrite.All https://analysis.windows.net/powerbi/api/Workspace.Read.All https://analysis.windows.net/powerbi/api/Workspace.ReadWrite.All""
expires_in:5166
ext_expires_in:5166
access_token:"eyJ0eXWGZAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCQWDI6Imwzc1EtNTBjQ0g0eEJWWkxIVEd3blNSNzY4MCIsImtpZCI6Imwzc1EtNTBjQ0g0eEJWWkxIVEd3blNSNzY4MCJ9.eyJhdWQXXXXXXXXXXXGFzZXQuUXXXXXXmVhZFdyaX...
expires_on:1639504569
I found the solution.
If anyone faces the same problem - here is what i did:
Since im using "Accounts in any organizational directory (Any Azure AD directory - Multitenant), the correct authentication endpoint is /organizations/ and not /common/.
(i used the same url part - common - like i did with my service for OneDrive.. but my connection to PBI is only intendet for organizational accounts and not for 'all' kinds of accounts)
It is essential to use the correct endpoint for the corresponding setting in the azure ad app:
You can look it up here. https://docs.microsoft.com/de-de/azure/active-directory/develop/active-directory-v2-protocols#endpoints
1 Reply
- albrejRegular Visitor
I found the solution.
If anyone faces the same problem - here is what i did:
Since im using "Accounts in any organizational directory (Any Azure AD directory - Multitenant), the correct authentication endpoint is /organizations/ and not /common/.
(i used the same url part - common - like i did with my service for OneDrive.. but my connection to PBI is only intendet for organizational accounts and not for 'all' kinds of accounts)
It is essential to use the correct endpoint for the corresponding setting in the azure ad app:
You can look it up here. https://docs.microsoft.com/de-de/azure/active-directory/develop/active-directory-v2-protocols#endpoints