Forum Discussion
Mottor
9 years agoFrequent Visitor
AADSTS50001 error on Web API with Azure AD
Hi, I have a Web API services on company server, which use Azure Active Directory for authentication. Now I want to connect to these services from Power BI Desktop. (New source -> Web -> From We...
Anonymous
9 years agoNot applicable
Hi Mottor,
I find a sample about use power query to call the azure api(not azure ad), perhaps you can reference to below code:
let
AzureMLJsonToTable = (
WebServiceURI as text,
WebServiceKey as text,
TableToScore as table,
optional Timeout as number
) as any =>
let
WebTimeout = if Timeout = null then #duration(0,0,0,100) else #duration(0,0,0,Timeout) ,
WebServiceContent = ToAzureMLJson(TableToScore),//method which used to convert the table to json
//example:
WebServiceURI1 = "https://europewest.services.azureml.net/workspaces/dcfeb7f96e2d431cb836299c27661e1e/services/d6291034e7c44b3ab63f0b26772a583b/execute?api-version=2.0&details=true",
WebServiceKey1 = "Pxy+NXyx/YZA/YkD0OENmG4awDZGpLeHGFKKf5XgC6sKgJPPO/CUp4tin15N8aMWgpKbu41Nv9/ruWW2rIKUHA==",
WebResponse = Web.Contents(WebServiceURI,
[Content = Text.ToBinary(WebServiceContent),
Headers = [Authorization="Bearer " & WebServiceKey,
#"Content-Type"="application/json",
Accept="application/json"],
Timeout = WebTimeout]),
output = AzureMLJsonToTable(WebResponse) // method which used to convert json to table
in
output
in
AzureMLJsonToTable
Regards,
Xiaoxin Sheng
lars_k
7 years agoAdvocate I
Anonymous That response does not help at all. I'm having this same problem, using PowerQuery for Excel. There's a "hidden" application involved (see here: https://stackoverflow.com/a/42513455/287610) and apparently the user needs to grant consent to that. I would like to know if there's a workaround so that Excel properly authenticates with my client ID to begin with.