Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Moving workspace content

So we have lots of workspaces that have content but we would like to move the content to one workspace for easy-to-find reports/datasets/apps/etc. With the new workspaces, is there a way to merge, migrate, or simply transport information to another workspace? The idea is to be able to delete workspaces after their contents have been moved.

4 Replies

  • dalabera's avatar
    dalabera
    Frequent Visitor

    Yes, very easy to do with PowerShell. 

     

    Below is a snippet of powershell I use to create the workspace automatically. 

     

    # STEP 1.1: Connect to to the PowerService
    Connect-PowerBIServiceAccount

    $StartTime = $(get-date)

    #------------------------------------------------------------------
    # STEP 2.1: Create Workspace 1
    #------------------------------------------------------------------
    $Workspace_Name1 = "My Workspace"
    $target_workspace1 = New-PowerBIWorkspace -Name $Workspace_Name1


    if (!$target_workspace1 -or $target_workspace1.isReadOnly -eq "True") {
    Write-Error "Invalid choice: you must have edit access to the workspace."
    break
    }
    # Update Wrkspace Description
    Set-PowerBIWorkspace -Scope Organization -Id $target_workspace1.id -Description "My Description."

    # STEP 2.2: Grant Mark access to Workspace
    Add-PowerBIWorkspaceUser -Scope Individual -Id $target_workspace1.Id -UserEmailAddress [email protected] -AccessRight Admin


    # STEP 2.3: Upload File.
    New-PowerBIReport -Path 'C:\temp\PowerBI\My Dashboard.pbix' -Name 'The Dashboard' -Workspace ( Get-PowerBIWorkspace -Name $Workspace_Name1 )


    $elapsedTime = $(get-date) - $StartTime
    $totalTime = "{0:HH:mm:ss}" -f ([datetime]$elapsedTime.Ticks)
    Write-Host $totalTime