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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
IanV
Frequent Visitor

PowerBIClient Throwing Http Exception When trying to Access Reports

I'm trying to create a PowerBI Client to user with Power BI Embedded (app owns data)

 

I've followed the examples and looked at the sample project/configs here, but I keep getting the following error:

 

System.Net.WebException : The remote name could not be resolved: 'analysis.windows.net'

The authentication code is pretty much identical to the sample: 

 

// Create a user password credentials: My AD user for Azure and Power BI
var credential = new UserPasswordCredential(Username, Password);

// Authenticate using created credentials
// AuthorityUrl = https://login.windows.net/common/oauth2/authorize/
var authenticationContext = new AuthenticationContext(AuthorityUrl);

// ResourceUrl = https://analysis.windows.net/powerbi/api (taken from examples and is also in the sample project config)
// ClientId = the app ID from registering at https://dev.powerbi.com/apps
var authenticationResult = await authenticationContext.AcquireTokenAsync(ResourceUrl, ClientId, credential);

if (authenticationResult == null)
{
    return View(new EmbedConfig()
    {
        ErrorMessage = "Authentication Failed."
    });
}

var tokenCredentials = new TokenCredentials(authenticationResult.AccessToken, "Bearer");

// ApiUrl = https://api.powerbi.com
using (var client = new Microsoft.PowerBI.Api.V2.PowerBIClient(new Uri(ApiUrl), tokenCredentials)
{
    var groups = await client.Groups.GetGroupsAsync(); // errors out here
}

Any ideas? Did I misconfigure something, or should it be pointing somewhere else?

3 REPLIES 3
v-jiascu-msft
Employee
Employee

Hi @IanV,

 

Could you please tell me if you get the answer or the solution?

 

Best Regards,

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

it could also be that the lower TLS 1.0 0r 1.1 requests are rejected or refused. 

v-jiascu-msft
Employee
Employee

Hi @IanV,

 

It seems it doesn't arise from Power BI. I would suggest you check your local DNS. Please refer to exception-the-remote-name-could-not-be-resolved-aspnet-35-c?f and system-net-webexception-the-remote-name-could-not-be-resolved.

 

Best Regards,

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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