Forum Discussion

msprog's avatar
msprog
Advocate III
1 year ago
Solved

Reading file from onedrive

I am working on PowerBI. I have a report that reads a file from my onedrive account. Now the concern raised is what will happen if i leave the organisation- my one drive account will be disabled. So how can we address this concern?

Is it possible to create a generic non-user account which has onedrive access? or any other better way please 

  • Hi msprog,

    Thanks for reaching out to the Microsoft fabric community forum.


    To address your issue -
    Move the File to SharePoint or a Team’s OneDrive :

    SharePoint document libraries (which back Microsoft Teams and shared OneDrive locations) are not tied to an individual user account, so they remain available even if a team member leaves.

    Steps:

    Move the Excel/CSV file to a SharePoint Online document library (e.g., a Team site or a shared department folder).
    In Power BI Desktop -Use “Get Data” - Web or SharePoint Folder option. Use the link to the file in SharePoint (make sure it is a direct or accessible path). Publish the report to Power BI Service. Set up scheduled refresh using OAuth2 with a service account or admin-managed account .

    (Alternative  Solution)
    Use a Shared Service Account for OneDrive : 
    Keeps using OneDrive approach. Isolated from any individual user's employment status.

    Try To implement:

    Create a generic OneDrive account, e.g - [email protected] (make sure it's a licensed Microsoft 365 user). Upload the data file to that account’s OneDrive. Share the file with yourself (and others, if needed). Update your Power BI report to use this new file path. When setting up refresh in the Power BI Service - 

    • Sign in using that generic account for authentication to OneDrive

    • Use OAuth2 authentication, so that Power BI uses the token of the service account.

     

    If the response has addressed your query, please Accept it as a solution and give a 'Kudos' so other members can easily find it

    Best Regards,
    Sreeteja.
    Community Support Team 

     




10 Replies

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

    Hi msprog,

    Thanks for reaching out to the Microsoft fabric community forum.


    To address your issue -
    Move the File to SharePoint or a Team’s OneDrive :

    SharePoint document libraries (which back Microsoft Teams and shared OneDrive locations) are not tied to an individual user account, so they remain available even if a team member leaves.

    Steps:

    Move the Excel/CSV file to a SharePoint Online document library (e.g., a Team site or a shared department folder).
    In Power BI Desktop -Use “Get Data” - Web or SharePoint Folder option. Use the link to the file in SharePoint (make sure it is a direct or accessible path). Publish the report to Power BI Service. Set up scheduled refresh using OAuth2 with a service account or admin-managed account .

    (Alternative  Solution)
    Use a Shared Service Account for OneDrive : 
    Keeps using OneDrive approach. Isolated from any individual user's employment status.

    Try To implement:

    Create a generic OneDrive account, e.g - [email protected] (make sure it's a licensed Microsoft 365 user). Upload the data file to that account’s OneDrive. Share the file with yourself (and others, if needed). Update your Power BI report to use this new file path. When setting up refresh in the Power BI Service - 

    • Sign in using that generic account for authentication to OneDrive

    • Use OAuth2 authentication, so that Power BI uses the token of the service account.

     

    If the response has addressed your query, please Accept it as a solution and give a 'Kudos' so other members can easily find it

    Best Regards,
    Sreeteja.
    Community Support Team 

     




  • msprog's avatar
    msprog
    Advocate III

    Poojara_D12  v-sshirivolu  i place the file in a sharepoint document library. I publish the report to the service. Now i login into the PBI service using my account.  i need to configure the dataset to read the file. I don't see any option to configure a service account. Under oauth2, it just says signin - it uses the singed in account which is my personal account . 

    Secondly, if i use a service account, how do i ensure the service account has access to the file?  please clarify

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

      Hi msprog 

      1. Ensure the service account has the necessary Microsoft 365 license (e.g., Power BI Pro if needed).

      2. Share the SharePoint file (or folder) with the service account (e.g., [email protected]

        • Open the SharePoint document library.

        • Click on the file or folder → "Share" → Invite the service account with View/Read access.

      3. Log into Power BI Service using the service account (once):

        • This is just to establish credentials.

        • After login, go to the dataset settings → Data source credentials → Edit credentials.

        • Choose OAuth2 → Sign in, and use the service account to authenticate.

      4. Once authorized, Power BI will use that token (service account) for refreshes — even if the report was published by another user.


         

       

      • msprog's avatar
        msprog
        Advocate III

        Hello thanks for your support. But i tried the approach you are suggesting. when i login using the shared service account, it says that the semantic model is owned by the original user. isn't this an issue? if the original owner republishes the report or the model , will this still work?

  • Hi msprog ,

    One solution is to store the document in a shared SharePoint team folder and grant access through an Active Directory (AD) security group. This approach simplifies access management and ensures that the file remains accessible even if someone leaves the organization.

     

    Additionally, you can grant access to a service account, then authenticate Power BI to the SharePoint folder using that service account. This ensures long-term stability, avoiding issues if a user leaves.

    If this helped, please mark it as the solution so others can benefit too. And if you found it useful, kudos are always appreciated.

    Thanks,

    Samson

     

    Connect with me on LinkedIn

    Check out my Blog

    Going to the European Microsoft Fabric Community Conference? Check out my Session

    • msprog's avatar
      msprog
      Advocate III

      Thanks for this. Once i publish the pbi report to the service, i need to configure the dataset to read the sharepoint file.  how do i grant access to the service account to the sharepoint folder?

  • Hi msprog 

    You're absolutely right to be concerned—if your Power BI report reads data from your personal OneDrive (associated with your user account), that connection will break once your account is disabled (e.g., if you leave the organization), because OneDrive access is tied to your individual identity. The best practice in this scenario is to avoid using personal or individual OneDrive accounts for shared or organizational reports. Instead, the recommended solution is to store the file in a SharePoint Online Document Library (which is part of Microsoft 365 and can be backed by Teams or a shared SharePoint site). Power BI supports connecting directly to SharePoint folders, and files placed there are not tied to an individual user’s lifecycle. Alternatively, if your organization prefers OneDrive, you can request your IT department to create a shared or generic service account with a OneDrive or SharePoint license. This account should be managed like a service identity, with access delegated appropriately. The file would then reside in that account’s storage, and the Power BI dataset would connect to it using that service account's credentials. Make sure to set up a Power BI gateway or OAuth credentials accordingly in the Power BI Service. This ensures continuity of access and minimizes risk due to personnel changes, making your report architecture more sustainable and enterprise-compliant.