Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Marco76
New Member

Problem getting PBI Desktop to send right resource_id to Azure AD (Multi-tenant)

 

Hi, 

 

I have this ODATA API: http://****azurewebsites.net/api/odata

I have it registered as multi-tenant on azure AD and App ID URI is something like: https://mytenantname.onmicrosoft.com/OdataAPI

 

I have it proteceted by Authorize attribute and i have some customHeaders on webconfig.cs:

 

 

<httpProtocol>
   <customHeaders>
        <add name="WWW-Authenticate" value="Bearer error=invalid_token, error_description=Error during token validation!, authorization_uri=https://login.windows.net/common/ouath2/authorize, resource_id=https://mytenantname.onmicrosoft.com/OdataAPI"/>
    </customHeaders>
</httpProtocol>

 

I also have clientIDclientSecret, Tenant and Audience and i use WindowsAzureActiveDirectoryBearerAuthentication

 

public partial class Startup
{
        public static string Audience = ConfigurationManager.AppSettings["ida:Audience"];
        public static string Tenant = ConfigurationManager.AppSettings["ida:Tenant"];
 
        public void ConfigureAuth(IAppBuilder app)
        {
            app.UseWindowsAzureActiveDirectoryBearerAuthentication(new WindowsAzureActiveDirectoryBearerAuthenticationOptions
            {
                Tenant = Startup.Tenant,
                TokenValidationParameters = new TokenValidationParameters
                {
                    ValidAudience = Startup.Audience,
                    ValidateIssuer = false
                }
            });
        }
}

 

 

When I try to get my data from API, I can choose organizational account, I try to login but i get this error:

invalid_resource: AADSTS50001: The application named http://****azurewebsites.net was not found in the tenant named ****-****-****-****-****.  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.

The problem is PBI always sends to AAD, as the resource_id, the URL of API instead of the resource_id i put in API response headers. Basically, i can´t use my API ID URI as resource, and i don´t know what is wrong.

 

Any ideas?

 

Note: It works if i run API from IIS and my APP ID URI as an alias of my localhost address. That's because PBI Desktop always use as resource_id the base URL of the service which is connected.

 

 

0 REPLIES 0

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.