Forum Discussion
IanV
8 years agoFrequent 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
- v-jiascu-msftMicrosoft 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
- v-jiascu-msftMicrosoft Employee
- AnonymousNot applicable
it could also be that the lower TLS 1.0 0r 1.1 requests are rejected or refused.