Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Promote a Power BI Report from a QA Workspace to a Prod Workspace, while preserving the connection to the Prod database when the updated report lands in the Prod Workspace.
$source_workspace_ID = (Get-PowerBIWorkspace -Name 'QA-Workspace').Id
$report = Get-PowerBIReport -Name 'Regional Sales' -WorkspaceId $source_workspace_ID
$target_workspace_ID = (Get-PowerBIWorkspace -Name 'Prod-Workspace').Id
$targetReport = Get-PowerBIReport -Name 'Regional Sales' -WorkspaceId $target_workspace_ID
Copy-PowerBIReport -Report $report -WorkspaceId $source_workspace_ID -TargetWorkspaceId $target_workspace_ID -TargetDatasetId ($targetReport).DatasetId -OutVariable NewReport
<# Now to remove the old version of the report in the Prod workspace #>
#$url = 'https://api.powerbi.com/v1.0/myorg/groups/' + $target_workspace_ID + '/reports/' + $targetReport.Id
#Invoke-PowerBIRestMethod -Method Delete -Url $url
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.