Forum Discussion

SuperFiets_'s avatar
SuperFiets_
Helper I
2 years ago
Solved

Deploying master semantic model to multiple (100) workspaces and editing parameter

Hello everyone,   In a Power BI workspace with Git setup I have a "master" dataset that we use to update constantly but is also used for different datasets for clients (datasets, not reports!). Thi...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Thank you Greg_Deckler 

    Hi, SuperFiets_ 

    We can use PowerShell commands to deploy the semantic model into multiple workspaces, and as you described, after deployment, you need to leverage the PowerAPI to change the parameters.
    In the following, I'll walk you through deploying a PBIX file into multiple workspaces:

    First, we need to follow the PowerShell command of Power BI:

    Install-Module -Name MicrosoftPowerBIMgmt

    Use the following command to deploy your Main Semantic Model into multiple workspaces:

    Connect-PowerBIServiceAccount
    $Path = "C:\Users\xxxx\Desktop\Protest.pbix"
    $targetWorkspaceIds = ("xxxx-xxx-xxx-xxx","xxxx-xxx-xxx-xxx","xxxx-xxx-xxx-xxx")
    foreach($targetWorkspaceIds in $targetWorkspaceIds){
         New-PowerBIReport -Path $Path -Name "Testaaa" -WorkspaceId $targetWorkspaceIds
    } 

    The result returned in PowerShell is as follows:

    Check if they were deployed successfully in Power BI:

    You can learn about these PowerShell commands from the following connection:

    New-PowerBIReport (MicrosoftPowerBIMgmt.Reports) | Microsoft Learn

    GitHub - microsoft/powerbi-powershell: PowerShell community for Microsoft PowerBI. Here you will find resources and source for PowerShell modules targeting PowerBI.

    Since you have more than 100 workspaces, you can consider using the following PowerShell command to list all the workspaces, and then collect the workspace IDs that need to be deployed through PowerShell programming, and then use the above command to deploy with one click.

    Get-PowerBIWorkspace -All

     

     

    Best Regards

    Jianpeng Li

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.