Forum Discussion

tobias29's avatar
tobias29
Frequent Visitor
6 months ago
Solved

Authentication and Query issues - cannot authenticate, queries hang

I have a report that's been causing me issues for weeks. It's massive and has lots of queries with fairly complex operations, so always takes hours to work on.  I'm trying to publish a fix in one of the queries due to the data source changing format.

 

When I apply the change, I get 'We couldn't authenticate with the credentials provide' on one of my organization's SharePoint sites  Here's an example of how the queries connect to SharePoint:


Source = SharePoint.Files("https://company.sharepoint.com/teams/myteam", [ApiVersion = 15]),
#"Filtered Rows" = Table.SelectRows(Source, each ([Folder Path] = "https://company.sharepoint.com/teams/myteam/Shared   Documents/the/desired/folder/")),

 

- I have tried changing the setting in Security to use my default browser for authentication. The authentication popup hangs for a while, disppears, giving me hope that it's worked, then pops up a while later saying the same error.

- I have tried to apply the permissions at the team level as opposed to the root level. Same issue.

- I have tried to clear global permissions, but then the authentication popup hangs whilst trying to connect using my credentials - this is weird.

- I have downloaded the pbix file and started from fresh to see if the change (changing remove columns to select columns) was causing issues - same issue.

 

Note: Nothing changed, I'm not aware of anything that would have caused this to happen.

 

This is really frustrating me. Any help would be appreciated.

  • Hi tobias29

    have you tried to start with a new report and a blank query to isolate the issue. By this you can check if the issue is on the Sharepoint Auth itself or not. From there you can dig deeper in troubleshooting.

     

    Possible next checks:

     

    • Clear Power BI Desktop credential cache: File → Options → Data source settings → Clear all cached credentials, then restart Desktop
    • Use Organizational account authentication instead of Windows credentials when the prompt appears
    • Try authenticating with anonymous first, then switch back to organizational (forces credential refresh)
    • Sign out and sign back into Power BI Desktop completely
    • Check if corporate VPN or firewall settings changed (blocking OAuth endpoints)
    • Try from a different network (home WiFi vs office network)

       

       

    Best regards!

    PS: If you find this post helpful consider leaving kudos or mark it as solution

3 Replies

  • Hi tobias29

    have you tried to start with a new report and a blank query to isolate the issue. By this you can check if the issue is on the Sharepoint Auth itself or not. From there you can dig deeper in troubleshooting.

     

    Possible next checks:

     

    • Clear Power BI Desktop credential cache: File → Options → Data source settings → Clear all cached credentials, then restart Desktop
    • Use Organizational account authentication instead of Windows credentials when the prompt appears
    • Try authenticating with anonymous first, then switch back to organizational (forces credential refresh)
    • Sign out and sign back into Power BI Desktop completely
    • Check if corporate VPN or firewall settings changed (blocking OAuth endpoints)
    • Try from a different network (home WiFi vs office network)

       

       

    Best regards!

    PS: If you find this post helpful consider leaving kudos or mark it as solution

  • v-dineshya's avatar
    v-dineshya
    Community Support

    Hi tobias29 ,

    Thank you for reaching out to the Microsoft Community Forum.

     

    Hi Mauro89 , Thank you for your prompt response.

     

    Hi tobias29 , In addition to Mauro89  response, i have added some points.

     

    1. Switch to system browser auth: In File --> Options and settings --> Options --> Security, check Use my default web browser. If it’s already checked and you use Edge, temporarily set Chrome or vice‑versa as your OS default browser and retry.

    2. Re‑connect using the SharePoint connector:
    Get Data --> SharePoint Folder --> Site URL = https://company.sharepoint.com/teams/myteam --> Connect --> Organizational account --> Sign in and apply at the organizational/site level.

    3. Please try below M code.

    let
    SiteUrl = "https://company.sharepoint.com/teams/myteam",
    Source = SharePoint.Files(SiteUrl, [ApiVersion = "Auto"]),
    Folder = "https://company.sharepoint.com/teams/myteam/Shared Documents/the/desired/folder/",
    Filtered= Table.SelectRows(Source, each Text.StartsWith([Folder Path], Folder)),
    // keep only required columns to reduce payload
    Kept = Table.SelectColumns(Filtered, {"Folder Path","Name","Content"})
    in
    Kept

    4. Target a single file via SharePoint.Contents:

    let
    SiteUrl = "https://company.sharepoint.com/teams/myteam/",
    FilePath = "Shared Documents/the/desired/folder/YourFile.xlsx",
    FileBin = SharePoint.Contents(SiteUrl){[Name="YourFile.xlsx", FolderPath=SiteUrl & "Shared Documents/the/desired/folder/"]}[Content],
    Excel = Excel.Workbook(FileBin, null, true)
    in
    Excel

     

    I hope this information helps. Please do let us know if you have any further queries.

     

    Regards,

    Dinesh

    • v-dineshya's avatar
      v-dineshya
      Community Support

      Hi tobias29 ,

      We haven’t heard from you on the last response and was just checking back to see if you have a resolution yet. And, if you have any further query do let us know.

       

      Regards,

      Dinesh