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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
dolenc
Frequent Visitor

Tenant login and open report Operation returned an invalid status code 'Unauthorized'

I login with Tenant and I get token, but when code exceute "client.Reports.GetReportsInGroupAsync"

 

 

 

 using (var client = new PowerBIClient(new Uri("https://api.powerbi.com/"), m_tokenCredentials))
                {
 
                    // Get a list of reports.
                    var reports = await client.Reports.GetReportsInGroupAsync(WorkspaceId).ConfigureAwait(false);

 

 

I get error: Operation returned an invalid status code 'Unauthorized'

If I login with username and password I get reports in that workspace. 

 

power bi settings:

powerb-tenant.jpgpowerb-tenant.jpg

 

azure settings:

powerb-tenant.jpgpowerb-tenant.jpg

 

Wht I do wrong?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

HI @dolenc,

I think this issue should more relate to the request URL, it seems like you directly invoke the homepage site of power bi service instead of the getting access token URL.

You can use 'https://analysis.windows.net/powerbi/api' with additional parameters (username, password, client_id, client_secret) and try again.

Comments:
username=your@email.com
password=yourpassword
client_id=your client id from the Azure app you create
client_secret=your secret from the Azure app you create

Regards,

Xiaoxin Sheng

View solution in original post

1 REPLY 1
Anonymous
Not applicable

HI @dolenc,

I think this issue should more relate to the request URL, it seems like you directly invoke the homepage site of power bi service instead of the getting access token URL.

You can use 'https://analysis.windows.net/powerbi/api' with additional parameters (username, password, client_id, client_secret) and try again.

Comments:
username=your@email.com
password=yourpassword
client_id=your client id from the Azure app you create
client_secret=your secret from the Azure app you create

Regards,

Xiaoxin Sheng

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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