Forum Discussion
Uploading PBIX File in C# sample (HELP!)
- 7 years ago
Hi brunozanoelo
You don't need dedicated capacity now. It has no connection with the autentication.
Are you running behind the code behind any proxy ? Which blocks your autentication ?
Can you try executing in Post man ?
Thank you so much for your reply.
I´ve changed my code as u said but now is giving me this error:
System.AggregateException
HResult=0x80131500
Message=Um ou mais erros.
Source=mscorlib
StackTrace:
em System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
em System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
em System.Threading.Tasks.Task`1.get_Result()
em PbixInstallerForPowerBI.Program.AcquireAccessToken() em D:\Bitbucket\PowerBI\Integração REST\PbixInstallerForPowerBI-master\PbixInstallerForPowerBI\Program.cs:linha 54
em PbixInstallerForPowerBI.Program.Main() em D:\Bitbucket\PowerBI\Integração REST\PbixInstallerForPowerBI-master\PbixInstallerForPowerBI\Program.cs:linha 303
Exceção interna 1:
AdalServiceException: AADSTS65001: The user or administrator has not consented to use the application with ID '75d071b1-378d-4f76-bb68-da4e033cf646' named 'instalador'. Send an interactive authorization request for this user and resource.
Trace ID: 20ec587e-39c6-4afa-acbb-67dfe8c9c800
Correlation ID: a7f7e02e-ffde-453b-b331-89c2e89a3601
Timestamp: 2019-08-14 17:32:02Z
Exceção interna 2:
AdalServiceException: Response status code does not indicate success: 400 (BadRequest).
What should be?
BEST regards
Hi brunozanoelo
The admin needs to consent your application. You can do this from you Azure Active Directory for your application called instalador
Another little change in the code to force TLS1.2, pls update your code like below
System.Net.ServicePointManager.SecurityProtocol = System.Net.ServicePointManager.SecurityProtocol | System.Net.SecurityProtocolType.Tls12;
var userCreds = new UserPasswordCredential("[email protected]", "myEasyToCrackPassword");
var userAuthnResult = authenticationContext.AcquireTokenAsync(ProgramConstants.PowerBiServiceResourceUri,
ProgramConstants.ClientID,
userCreds).Result;- brunozanoelo7 years agoPost Patron
Jayendran Thank you for the help. I really appreciate it.
It worked to authenticate but now I´m facing one problem in my workspace. I already set all the permissions to this app, including read/write workspaces.
Error (cannot find workspace)Workspace
Permissons
Any tip? I´m trying everything in Azure and nothing solve this problem.?
Warm Regards.- Jayendran7 years agoSolution Sage
Hi brunozanoelo ,
I tried the same thing it works for me.
Here some few tips
- Check whether you user credentials (user name/password) having access to the workspace.
- Using the fiddler find what API is exactly calling and whether you are getting any error in the fiddler
I see that this is calling
https://api.powerbi.com/v1.0/myorg/groups
https://docs.microsoft.com/en-us/rest/api/power-bi/groups/getgroups
It requires the scope of Workspace.Read.All or Workspace.ReadWrite.All but from the screenshot you also having that
- brunozanoelo7 years agoPost Patron
Hello my friend,
I´ve found that the problem is actually not in the workspace, but still in the authentication function.
See the image bellow. I think my code is correct, isn't? The client ID it´s the correct one, I already checked!
Auth not passed