Forum Discussion

mvyas's avatar
mvyas
New Member
1 year ago
Solved

Quick Fix for OAuth2 or “Organizational Account” Authentication Support in Power BI Report Server

Hi Everyone, Our team is currently using Power BI Report Server (PBIRS) and is facing the challenge that OAuth2 or “Organizational Account” authentication types are not supported for scheduled d...
  • v-kathullac's avatar
    1 year ago

    Hi mvyas,

    Thank you for reaching out to Microsoft Fabric Community Forum.

    Power BI Report Server (PBIRS) does not support OAuth2 (including "Organizational Account") authentication for scheduled data refreshes. Below are the few workaround you can try: 

    1)Use Scheduled Data Export with Power Automate or PowerShell:

    • Set up a Power Automate flow to export SharePoint Online List/Excel content to a OneDrive or File Share.
    • Use a script or task scheduler to download the data from OneDrive to your on-prem folder.
    • In Power BI Desktop (for PBIRS), use the Folder or CSV data source.
    • Publish to PBIRS and schedule the refresh using a Windows credential.

    2)Store Files Locally via OneDrive Sync:

    • Use OneDrive sync client to sync a SharePoint document library locally.
    • Point Power BI to the synced folder (e.g., C:\Users\YourName\SharePoint Docs.)
    • Schedule refresh in PBIRS as it's now reading a local file (Windows auth works).

    PowerShell Script to Export SharePoint List to CSV:

    Install-Module -Name "PnP.PowerShell" -Force -Scope CurrentUser

    # Define variables
    $siteUrl = "https://yourtenant.sharepoint.com/sites/yoursite"
    $listName = "YourListName"
    $outputCsvPath = "C:\PBIRSData\SharePointData.csv"

    # Connect to SharePoint Online
    Connect-PnPOnline -Url $siteUrl -Interactive

    # Get list items (you can use -PageSize and -Fields if needed)
    $listItems = Get-PnPListItem -List $listName -PageSize 500

    # Convert to CSV format
    $data = $listItems | ForEach-Object {
    $item = $_.FieldValues
    [PSCustomObject]@{
    ID = $item["ID"]
    Title = $item["Title"]
    Created = $item["Created"]
    Modified = $item["Modified"]
    Status = $item["Status"] # Example custom field
    AssignedTo = $item["AssignedTo"] # Example custom field
    }
    }

    # Export to CSV
    $data | Export-Csv -Path $outputCsvPath -NoTypeInformation -Encoding UTF8

    Write-Host "Data exported successfully to $outputCsvPath"

     

    If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it!

     

    Regards,

    Chaithanya.