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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
dparkinson
Advocate I
Advocate I

Authentication Pain - adal-node

Hi,

 

I'm trying to authenticate with Azure AD to access the Power BI APIs, but having some trouble.

 

I'm using adal-node to write a console app that uses the server to server via client credentials example outlined here.

 

Unfortunately I can't seem to get access.

 

If I use https://login.windows.net/common/oauth2/authorize as the authority URI (as per the powerbi doc), I get a 404 which seems odd.  If I use the authority URI as per the example for adal-node, I appear to get a token.  On using that token to access api.powerbi.com though, I get a 403 error.

 

If anyone is able to shed some light on this, that would be great.

 

Many thanks,

D.

 

 

3 REPLIES 3
alexsilvar
Frequent Visitor

You should use the authorityHostUrl like this:

 

 

var authorityHostUrl = 'https://login.microsoftonline.com/';
var tenant = 'yourtenant.com';
var uri = authorityHostUrl + '/' + tenant;
...
var context = new adal.AuthenticationContext(uri);//Start adal context

([G]old)

 

Could you please elaborate on this? I am frustrated with the lack of granularity of the refresh process and would like to kick off a dataset refresh via powershell after I complete a number of ETL processes.

curtisp
Helper II
Helper II

This stackoverflow thread will probably help. Power BI needs user to be involved in authentication. The 403 is 'forbidden' so url is found but permissions not granted.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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