Forum Discussion

paddy_135's avatar
paddy_135
Frequent Visitor
1 year ago
Solved

Service Principal authentication (for Graph API) without hardcoded credentials

Hello! I am successfully getting data from Graph API (in a dataflow) using a Service Principal to authenticate. However, I've had to hardcode the credentials into the query - this is an issue as the ...
  • paddy_135's avatar
    1 year ago

    Ok, for anyone in the future wanting a (sort-of) solution...
    It turns out that service principal authentication via the UI in dataflows will work for beta graph API endpoints, but will not work for v1.0. For example, use https://graph.microsoft.com/beta/users instead of https://graph.microsoft.com/v1.0/users.

     

    We are changing all queries our queries use the beta endpoints. So far no particular issues, though of course there are some minor risks of things changing when using the beta endpoints. That being said, Microsoft themselves use beta endpoints for production purposes, so they should be quite stable.

     

    When setting it up, make sure that you are specifying the connection for either the full endpoint or for https://graph.microsoft.com/beta, not https://graph.microsoft.com as this won't work. Refer screenshot below.