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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
LukasB
New Member

Connect to GraphAPI with AAD registered App

Hi, 

 

I want to connect to Graph API and authenticate with a AAD App registration.

 

What works so far: 

I was able to generate a Bearer Token with this Query:

 

= let
BodyRecord = [grant_type = "client_credentials", resource = "CLIENTID", client_id = "CLIENTID", client_secret = "SECRET"],
Body = Uri.BuildQueryString(BodyRecord),
API = Web.Contents("https://login.microsoft.com/TENANT-URL/oauth2/token?api-version=1.0", [Content=Text.ToBinary(Body)]),
ChangeResponseToRecord = Json.Document(Text.FromBinary(API)),
GetAccessToken = ChangeResponseToRecord[access_token]
in
GetAccessToken

 

After this I added a new step and tried to use the Token to get some data from Graph, but there are some problems with the authentication. I used this Query:

 

= let data = Json.Document(Web.Contents("https://graph.microsoft.com/v1.0/users",
[
Headers = [
#"Authorization"="Bearer "&TOKEN, #"Content-Type"="application/json",
Accept="application/json"]

]
)
) in data

 

But then it asks me how I want to authenticate:

LukasB_0-1631855833776.png

 

When choosing "Anonymous" it does not work (I think because Graph blocks anonymous connections):

LukasB_1-1631855921064.png

 

"Web API" also does not work, no matter what I type into the Key field (don´t even know what to type here):

LukasB_2-1631856006007.png

 

Any Ideas how I can get the Authentication running?

 

Thanks a lot!

 

1 ACCEPTED SOLUTION
v-yingjl
Community Support
Community Support

Hi @LukasB ,

To connect to GraphAPI with AAD registered app, you can follow this blog step by step which introduces it in details from creating app in AAD to Power Query:

Easily connecting between Power Query / Power BI and Microsoft Graph 

 

In addition, you can create a custom connector to connect to it, here is another article:

CONNECTING POWER BI TO MICROSOFT GRAPH 

 

Similar thread: Use Microsoft Graph API as data source 

 

Best Regards,
Community Support Team _ Yingjie Li
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

1 REPLY 1
v-yingjl
Community Support
Community Support

Hi @LukasB ,

To connect to GraphAPI with AAD registered app, you can follow this blog step by step which introduces it in details from creating app in AAD to Power Query:

Easily connecting between Power Query / Power BI and Microsoft Graph 

 

In addition, you can create a custom connector to connect to it, here is another article:

CONNECTING POWER BI TO MICROSOFT GRAPH 

 

Similar thread: Use Microsoft Graph API as data source 

 

Best Regards,
Community Support Team _ Yingjie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.