Forum Discussion

Jessy_D's avatar
Jessy_D
Icon for Helper I rankHelper I
1 year ago
Solved

Importing microsoft api data in power bi fails

Hi,

 

We have 2 dataflows that import data from Microsoft REST API's but since Monday, the dataflows have lot's of issues to get passed the authentication step. When we try to get our token from https://login.microsoftonline.com/<id>/oauth2/token we don't get a response. When we try it in Power BI Desktop or Postman, it works immediatly. There hasn't been any changes on those dataflows for a couple of weeks. 

Anyone else has this issue?

  • Jessy_D's avatar
    Jessy_D
    1 year ago

    The issue has been resolved after an update from microsoft in the backend.

11 Replies

  • Hi Jessy_D  - can you please verify the application registration in Azure AD. Ensure the app has the correct permissions for the API and that the authentication settings match what Power BI requires.Test the authentication flow manually using Postman (as you did) and compare the request details with the ones used in the dataflow.

    Check the Microsoft Azure Status Page for any reported issues with Azure AD or related services.
    Ensure there are no firewall rules or proxy configurations that might block Power BI from accessing https://login.microsoftonline.com.

     

    Test if the issue persists when using a different region (e.g., set up the dataflow in another Power BI Service region).
    Contact Microsoft Support to confirm if there are any region-specific issues.

     

     

  • Hi Jessy_D ,

     

    If you are passing any parameters please disable load. 

     

    I hope it will fix the issue.

     

    Thanks,

    Sai Teja 

  • 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-karpurapud's avatar
      v-karpurapud
      Icon for Community Support rankCommunity 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_D's avatar
        Jessy_D
        Icon for Helper I rankHelper 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.

    • Jessy_D's avatar
      Jessy_D
      Icon for Helper I rankHelper I

      jake_BIV I have been in contact and it is confirmed by the support desk from Microsoft it is a bug with at least the gen 1 dataflows. It works all if you place all the code in a semantic model, but this is not preferred because we use the data in several other situations and we prefer dataflows.

      • v-karpurapud's avatar
        v-karpurapud
        Icon for Community Support rankCommunity Support

        Hi Jessy_D 

        I would like to know if the issue has been resolved. If so, kindly mark the reply that provided the solution as accepted. This will help other community members facing similar challenges to find a resolution more efficiently.

        Thank you!