Back

Explore Courses Blog Tutorials Interview Questions
0 votes
3 views
in BI by (17.6k points)

In Power Bi we get this error when trying to make a web connection:

"We couldn't authenticate with the credentials provided. Please try again"

The Azure function app is registered in our AAD. The function is a C# HTTP trigger with this code:

using System.Net;

using System.Net.Http;

using System.Security.Claims;

using System.Threading.Tasks;

public static async Task<HttpResponseMessage> Run(HttpRequestMessage req, TraceWriter log)

{

// parse query parameter

ClaimsIdentity userClaimsId = ClaimsPrincipal.Current.Identity as ClaimsIdentity;

    var claims = userClaimsId.FindAll(ClaimTypes.Upn);

    var groups = userClaimsId.Claims.Where(x => x.Type.Equals("groups")).ToList();

    var upns = userClaimsId.Claims.ToList();

    var roles = userClaimsId.Claims.Where(x => x.Type.Equals("upn")).ToList();

    return  req.CreateResponse(HttpStatusCode.OK, groups);

}

We are attempting to connect from Power Bi Desktop via the Get Data > Web option using an organizational account in our same AAD. When we call the function from the browser it prompts for login and seems to return data.

1 Answer

0 votes
by (47.2k points)

To consume such kind of authentication, the website must implement something:

https://docs.microsoft.com/en-us/azure/app-service/configure-authentication-provider-aad

You need to ensure that you have implemented this section. If the issue still exists, you have to run the Fiddler with below option tabled then repeat steps to reproduce the issue in Power BI desktop, save all sessions and share .saz file with us. You can upload this file to your OneDrive or Dropbox and share the link here.

Browse Categories

...