Forum Discussion
Could not get data from web that uses Azure AD authentication
It works perfectly in browser and provides REST APIs that return JSON data.
Can you show the detail about this success implement of RESTful Api?
Can we trouble shooting on it?
- SYang89Apr 01, 2024Copper Contributor
As you can see from the documentation here (https://learn.microsoft.com/en-us/power-query/connector-authentication), it reads "When you select Sign-in in Step 2 above, Power Query sends a request to the provided URL endpoint with an authorization header with an empty bearer token. The service is then expected to respond with a 401 response with a WWW-Authenticate header indicating the Microsoft Entra ID authorization URI to use. Power Query can then initiate the OAuth flow against the authorization_uri. Power Query requests a Microsoft Entra ID Resource or Audience value equal to the domain of the URL being requested. This value would be the value you use for your Azure Application ID URL value in your API/service registration."
You know, the sign in step was completed successfully. The next step, where power query initiate the OAuth flow against the authorization_uri, should be executed automatically and implicitly, if I understand correctly. But I got the error. It seams that power query for excel got an access token with a wrong audience value from the authorization_uri (https://login.microsoftonline.com/{tenant_id}/oauth2/authorize).
I have tried https://login.microsoftonline.com/{tenant_id}/oauth2/authorize?client_id={client_id}&response_type=code&redirect_uri={redirect_uri}&response_mode=query&resource={resource_id}&state={state} and still got the same error. How to get the right audience then?
- peiyezhuApr 01, 2024Bronze ContributorDifferent connectors show different authentication methods. For example, the OData Feed connector in Power BI Desktop and Excel displays the following authentication method dialog box.
https://learn.microsoft.com/en-us/power-query/connector-authentication
This should be different from each websites.
The url (https://learn.microsoft.com/en-us/power-query/connector-authentication) you mentioned did not provide specific information about your login(https://login.microsoftonline.com/%7Btenant_id%7D/oauth2/authorize?client_id=%7Bclient_id%7D&response_type=code&redirect_uri=%7Bredirect_uri%7D&response_mode=query&resource=%7Bresource_id%7D&state=%7Bstate%7D).
e.g.
From this url https://e.anyoupin.cn/EData/{Id}.html
you can get
https://e.anyoupin.cn/EData/1222.html
You should privide specific ID for trouble shooting.
It works perfectly in browser and provides REST APIs that return JSON data.
Can you show the detail about this success implement of RESTful Api?
Can you provide the specific url?
https://learn.microsoft.com/en-us/graph/auth-v2-user?tabs=http
As far as I know,you should use MS graph api if you want to access one driver.