Forum Discussion
Importing microsoft api data in power bi fails
- 1 year ago
The issue has been resolved after an update from microsoft in the backend.
Nothing has changed from permissions or anything at our side. It has always worked until Monday.
The dataflows are in the online version of Power BI, and we want to connect to login.microsoftonline.com. So no gateway is needed. Changing regions also didn't work.
I have 2 functions. One gets an token for the async api of microsoft, the other for the non async api of microsoft. Both don't work.
//non async api token
let
Source = () => let
apiUrl = "https://login.microsoftonline.com/<id>/oauth2/token",
body = [
client_id="<clientid>",
grant_type="client_credentials",
client_secret="<secret>",
resource="https://graph.windows.net"
],
Source = Json.Document(Web.Contents(apiUrl, [Headers = [Accept = "application/json"],
Content = Text.ToBinary(Uri.BuildQueryString(body))])),
access_token = Record.Field(Source, "access_token")
in
access_token
in
Source
//Async api token
let
Source = () => let
apiUrl = "https://login.microsoftonline.com/<id>/oauth2/v2.0/token",
body = [
client_id="<clientid>",
grant_type="client_credentials",
client_secret="<secret>",
scope="https://graph.microsoft.com/.default"
],
Source = Json.Document(Web.Contents(apiUrl, [Headers = [#"Content-Type" = "application/x-www-form-urlencoded", #"Accept" = "*/*"],
Content = Text.ToBinary(Uri.BuildQueryString(body))])),
access_token = Record.Field(Source, "access_token")
in
access_token
in
Source
- v-karpurapud1 year ago
Community Support
Hi Jessy_D
Hope you are doing well!
We would like to follow up to see if the solution provided by our super user rajendraongole1 has been helpful to you or let us know if you need any further assistance here?Your feedback is important to us, Looking forward to your response.
Thanks
- Jessy_D1 year ago
Advocate I
I have been in contact with the support of Microsoft. It still doesn't work, but we have been working hard to search for a solution. When we move to code from a dataflow to a semantic model, it works. When we replace the code for getting the access token with a fixed active token in the dataflow, it also works for the non async microsoft api, but not for the async api. That one only seems to work maybe once a day.
- SaiTejaTalasila1 year ago
Super User
Hi Jessy_D ,
Have you tried to disable load for the parameters on dataflow?.
I have created a bunch of MS Graph API connections for our clients and all of them are working fine.
You can try changing authentication and privacy.
Thanks,
Sai Teja