Forum Discussion

Mottor's avatar
Mottor
Frequent Visitor
9 years ago

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 Web -> Organizational account

And when I try to "Sign in",  I am getting:

"invalid_resource: AADSTS50001: The application named <WEB SERVICES DOMAIN> was not found in the tenant named <MY TENANT>. This can happen if the application has not been installed by the administrator of the tenant or consented to by any user in the tenant. You might have sent your authentication request to the wrong tenant."
Where can I set the client id? And why is the application searched the first part of the address (https://subdomain.domain.com)?

 

Best Regards

4 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Mottor,

     

    I try to connect the url which you provided, then I got a "404 Not Found" error.

     

    "invalid_resource: AADSTS50001: The application named <WEB SERVICES DOMAIN> was not found in the tenant named <MY TENANT>. This can happen if the application has not been installed by the administrator of the tenant or consented to by any user in the tenant. You might have sent your authentication request to the wrong tenant."

     

    Based on my test and your error message, I think the issue may related to custom domain setting. Can you ensure you have configured correctly?

     

    For detail information, you can refer to below article:

    Configuring a custom domain name for an Azure cloud service

     

    Regards,

    Xiaoxin Sheng

    • Mottor's avatar
      Mottor
      Frequent Visitor

      Hi Anonymous,

       

          I will try to explain. I have a web service on a serve inside our company. Let say its (fictive) address is https://mycompany.com/mywebservice.  Then I have registration in Azure Active Directory (portal.azure.com). From Azure I've got an Instance ('https://login.microsoftonline.com/') a Tenant (micompanygmbh.onmicrosoft.com) and a ClientId ( '12345abc-678d-9012-3456-fgh789ijkl01'), which I use (config) to connect from JavaScript, I use adal.js for authentication ( authContext = new AuthenticationContext(config);) and to get token ( authContext.acquireToken(authContext.config.clientId, function (error, token) {..});) and make request to web service. The web service use BearerTockenAuthentication.

         Now, Iwant to connect to this service from Power BI Desktop? I have to send the ClientId. Without it there is no access. That means I have to change the header. What should I do (use)?

       

      Best Regards

      • Anonymous's avatar
        Anonymous
        Not 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