I’m trying to publish a .PBIX file to an on-premises BI Report Server in an application.
I’ve found multiple methods for doing so by PowerShell, Rest API and C# but non of them worked for me.
By using the Microsoft.PowerBI.Api in C# I get “Operation returned an invalid status code ‘Unauthorized’“.
<code>BasicAuthenticationCredentials creds = new BasicAuthenticationCredentials();
creds.UserName = @"MYUSER";
creds.Password = @"MYPASSWORD";
using (PowerBIClient client = new PowerBIClient(new Uri(@"http://MYSERVER/Reports"), creds))
{
// List of datasets in a workspace
Datasets datasets = client.Datasets.GetDatasets(); //got 'Unauthorized' HERE
//...
}
</code>
<code>BasicAuthenticationCredentials creds = new BasicAuthenticationCredentials();
creds.UserName = @"MYUSER";
creds.Password = @"MYPASSWORD";
using (PowerBIClient client = new PowerBIClient(new Uri(@"http://MYSERVER/Reports"), creds))
{
// List of datasets in a workspace
Datasets datasets = client.Datasets.GetDatasets(); //got 'Unauthorized' HERE
//...
}
</code>
BasicAuthenticationCredentials creds = new BasicAuthenticationCredentials();
creds.UserName = @"MYUSER";
creds.Password = @"MYPASSWORD";
using (PowerBIClient client = new PowerBIClient(new Uri(@"http://MYSERVER/Reports"), creds))
{
// List of datasets in a workspace
Datasets datasets = client.Datasets.GetDatasets(); //got 'Unauthorized' HERE
//...
}
I also don’t want to install any PowerShell Module on clients for running my app.
Is there any solution to upload a .pbix file by simply provide Username and Password without the need of installing any module?