Yes, it is possible to publish a Power BI report saved in a SharePoint folder to a Power BI service workspace using PowerShell. Here are the high-level steps you can follow:
Connect to the SharePoint site using PowerShell: You can use the SharePoint PowerShell module to connect to the SharePoint site where the report is saved. You will need to authenticate with the appropriate credentials and import the SharePoint PowerShell module.
Get the report file: Once you are connected to the SharePoint site, you can use PowerShell to get the report file from the SharePoint folder. You can use the Get-ChildItem
cmdlet to get the file.
Connect to the Power BI service using PowerShell: You can use the Power BI PowerShell module to connect to the Power BI service. You will need to authenticate with the appropriate credentials and import the Power BI PowerShell module.
Publish the report to the Power BI service: Once you are connected to the Power BI service, you can use PowerShell to publish the report to the appropriate workspace. You can use the Import-PowerBIReport
cmdlet to import the report.
Configure scheduled refresh, refresh failure notifications, and app updates: Once the report is published, you can use PowerShell to configure scheduled refresh, refresh failure notifications, and app updates as needed.
Here is an example PowerShell script that you can use as a starting point:
mathematicaCopy code
# Connect to SharePoint
Connect-PnPOnline -Url <SharePoint site URL> -Credentials (Get-Credential)
# Get report file
$file = Get-ChildItem -Path <SharePoint folder path> -Filter <report file name>
# Connect to Power BI service
Connect-PowerBIServiceAccount
# Import report to Power BI service
Import-PowerBIReport -Path $file.FullName -WorkspaceName <workspace name>
# Configure scheduled refresh, refresh failure notifications, and app updates
# Insert PowerShell commands here
Note: This is just an example script, and you will need to customize it to fit your specific requirements.