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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
op-agw
Regular Visitor

Power BI REST API, HTTP 401

Hi all,

 

I've been able to successfully test connectivity of my App registration using the codebase, against the default `https://graph.microsoft.com/v1.0/users`

Azure-Samples/ms-identity-javascript-nodejs-console: A Node.js console daemon application secured by...

 

When attempting to test against the Power BI endpoints, I get a HTTP 401

 

As a quick test, I made the following changes on the codebase, to file `./bin/auth.js:21`

 

```

const tokenRequest = {
};

const apiConfig = {
};
```

 

API permissions on the app

The delegated permissions will be removed, as we will be building a Node-based daemon - we added the only `ReadWrite` permission that was displayed for Power BI, for application permissions.

 

Screenshot 2024-09-02 at 12.13.09.png

 

Would appreciate any help or suggestions; as it's looking as if this setup isn't possible? Thanks.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Thanks for the reply from Tayyabali , please allow me to provide another insight:

Hi, @op-agw .

HTTP 401 errors typically indicate authentication issues. Here are some possible workarounds:

1.First, check the access token: Make sure your application provided a valid access token in the request. The access token may be missing, invalid, or expired.

Here is a screenshot of the relevant documentation:

vlinyulumsft_0-1725354763924.png

Resolve Microsoft Graph authorization errors - Microsoft Graph | Microsoft Learn

2.Second, confirm that the permissions are sufficient: Make sure that you have assigned the correct API permissions to your application in the Azure portal and that they have been granted by the administrator.

vlinyulumsft_1-1725354763931.png

3.Next, make sure the Power BI service admin permissions are turned on

vlinyulumsft_2-1725354823507.png

4.Finally, debug tokens: Use a tool such as JWT.io to decode your access token, checking the permissions and expiration date in it

https://www.bing.com/search?q=JWT&form=ANNH01&refig=8661f8975dce4c1cb424494de4564ef1&pc=U531

Of course, if you have any new ideas, you are welcome to contact us.
 

Best Regards,

Leroy Lu

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

View solution in original post

3 REPLIES 3
op-agw
Regular Visitor

Thank you!

 

We just needed to enable the option "Service principals can use Fabric APIs"

All now appears to be working, and receiving data responses!

 

For others finding this, and need details on the Power BI admin portal: What is the Microsoft Fabric admin portal? - Microsoft Fabric | Microsoft Learn

Anonymous
Not applicable

Thanks for the reply from Tayyabali , please allow me to provide another insight:

Hi, @op-agw .

HTTP 401 errors typically indicate authentication issues. Here are some possible workarounds:

1.First, check the access token: Make sure your application provided a valid access token in the request. The access token may be missing, invalid, or expired.

Here is a screenshot of the relevant documentation:

vlinyulumsft_0-1725354763924.png

Resolve Microsoft Graph authorization errors - Microsoft Graph | Microsoft Learn

2.Second, confirm that the permissions are sufficient: Make sure that you have assigned the correct API permissions to your application in the Azure portal and that they have been granted by the administrator.

vlinyulumsft_1-1725354763931.png

3.Next, make sure the Power BI service admin permissions are turned on

vlinyulumsft_2-1725354823507.png

4.Finally, debug tokens: Use a tool such as JWT.io to decode your access token, checking the permissions and expiration date in it

https://www.bing.com/search?q=JWT&form=ANNH01&refig=8661f8975dce4c1cb424494de4564ef1&pc=U531

Of course, if you have any new ideas, you are welcome to contact us.
 

Best Regards,

Leroy Lu

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

Tayyabali
New Member

Power BI REST API, HTTP 401

16m ago

Hi all,

 

 

 

I've been able to successfully test connectivity of my App registration using the codebase, against the default `https://graph.microsoft.com/v1.0/users`

 

Azure-Samples/ms-identity-javascript-nodejs-console: A Node.js console daemon application secured by...

 

 

 

When attempting to test against the Power BI endpoints, I get a HTTP 401

 

 

 

As a quick test, I made the following changes on the codebase, to file `./bin/auth.js:21`

 

 

 

```

 

const tokenRequest = {

scopes: ['https://analysis.windows.net/powerbi/api/.default'],

};

 

const apiConfig = {

uri: 'https://api.powerbi.com/v1.0/myorg/groups',

};

```

 

 

API permissions on the app

 

The delegated permissions will be removed, as we will be building a Node-based daemon - we added the only `ReadWrite` permission that was displayed for Power BI, for application permissions.

 

 

 

Screenshot 2024-09-02 at 12.13.09.png

 

 

 

Would appreciate any help or suggestions; as it's looking as if this setup isn't possible? Thanks.

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.