### Install Specific Power BI Module Source: https://docs.microsoft.com/en-us/powershell/power-bi/overview Installs an individual Power BI module, such as the Workspaces module, if you only need specific cmdlets. Use this to reduce installation size. ```PowerShell Install-Module -Name MicrosoftPowerBIMgmt.Workspaces ``` -------------------------------- ### Install Power BI PowerShell Module Source: https://docs.microsoft.com/en-us/powershell/power-bi/overview Installs the main rollup module for Power BI cmdlets. Ensure you are in an elevated PowerShell session. ```PowerShell Install-Module -Name MicrosoftPowerBIMgmt ``` -------------------------------- ### Get Power BI Imports Source: https://docs.microsoft.com/en-us/powershell/power-bi/overview Retrieve a list of Power BI imports. ```PowerShell Get-PowerBIImport ``` -------------------------------- ### Get User Workspaces Source: https://docs.microsoft.com/en-us/powershell/power-bi/overview Retrieves a list of workspaces assigned to the current user. By default, it returns the first 100 workspaces. Use the -All parameter to retrieve all workspaces. ```PowerShell Get-PowerBIWorkspace ``` ```PowerShell Get-PowerBIWorkspace -All ``` -------------------------------- ### Get All Tenant Workspaces Source: https://docs.microsoft.com/en-us/powershell/power-bi/overview Retrieves all workspaces within the Power BI tenant. This command requires tenant administrator privileges and the -Scope Organization parameter. ```PowerShell Get-PowerBIWorkspace -Scope Organization -All ``` -------------------------------- ### Get Power BI Tiles Source: https://docs.microsoft.com/en-us/powershell/power-bi/overview Retrieve tiles within a specific dashboard. ```PowerShell Get-PowerBITile -DashboardId 9a58d5e5-61bc-447c-86c4-e221128b1c99 ``` -------------------------------- ### Get Power BI Datasources and Tables Source: https://docs.microsoft.com/en-us/powershell/power-bi/overview Retrieve datasources and tables associated with a specific dataset. ```PowerShell Get-PowerBIDatasource -DatasetId 65d7d7e5-8af0-4e94-b20b-50a882ae15e1 ``` ```PowerShell Get-PowerBITable -DatasetId 65d7d7e5-8af0-4e94-b20b-50a882ae15e1 ``` -------------------------------- ### Update Power BI PowerShell Module Source: https://docs.microsoft.com/en-us/powershell/power-bi/overview Updates the installed Power BI cmdlets to the latest version available on the PowerShell Gallery. ```PowerShell Update-Module -Name MicrosoftPowerBIMgmt ``` -------------------------------- ### Get Workspace Migration Status Source: https://docs.microsoft.com/en-us/powershell/power-bi/overview Checks the migration status of a Power BI workspace using its ID. This cmdlet is useful for tracking the progress of workspace migrations. ```PowerShell Get-PowerBIWorkspaceMigrationStatus -Id 038f9a64-1fcd-42f2-957a-13a63b3d3235 ``` -------------------------------- ### Uninstall Power BI PowerShell Cmdlets Source: https://docs.microsoft.com/en-us/powershell/power-bi/overview Removes all installed Power BI PowerShell cmdlets from your system. This command requires an elevated PowerShell session and the -Force parameter to proceed without prompts. ```PowerShell Get-Module MicrosoftPowerBIMgmt* -ListAvailable | Uninstall-Module -Force ``` -------------------------------- ### Create Power BI Reports Source: https://docs.microsoft.com/en-us/powershell/power-bi/overview Upload a .pbix file to create a report, optionally specifying a target workspace. ```PowerShell New-PowerBIReport -Path .\newReport.pbix -Name 'New Report' ``` ```PowerShell New-PowerBIReport -Path .\newReport.pbix -Name 'New Report' -WorkspaceId f95755a1-950c-46bd-a912-5aab4012a06d ``` -------------------------------- ### Manage Power BI Workspaces Source: https://docs.microsoft.com/en-us/powershell/power-bi/overview Commands for listing, restoring, and correcting orphaned workspaces. ```PowerShell Get-PowerBIWorkspace -Scope Organization -Deleted -All ``` ```PowerShell Restore-PowerBIWorkspace -Id "3244f1c1-01cf-457f-9383-6035e4950fdc" -RestoredName "TestWorkspace" -AdminEmailAddress "john@contoso.com" ``` ```PowerShell Get-PowerBIWorkspace -Scope Organization -Orphaned -All ``` ```PowerShell Add-PowerBIWorkspaceUser -Scope Organization -Id f2a0fae5-1c37-4ee6-97da-c9d31851fe17 -UserPrincipalName 'john@contoso.com' -AccessRight Admin ``` -------------------------------- ### Manage Power BI Datasets Source: https://docs.microsoft.com/en-us/powershell/power-bi/overview Commands for retrieving datasets and updating their storage mode. ```PowerShell Get-PowerBIDataset ``` ```PowerShell Set-PowerBIDataset -Id 038f9a64-1fcd-42f2-957a-13a63b3d3235 -TargetStorageMode PremiumFiles ``` -------------------------------- ### Add User to Workspace Source: https://docs.microsoft.com/en-us/powershell/power-bi/overview Assigns a user to a specific workspace with a defined access right (e.g., Admin). Requires the workspace ID, user's email, and administrator privileges. ```PowerShell Add-PowerBIWorkspaceUser -Scope Organization -Id 3244f1c1-01cf-457f-9383-6035e4950fdc -UserEmailAddress john@contoso.com -AccessRight Admin ``` -------------------------------- ### Power BI Workspace Management Cmdlets Source: https://docs.microsoft.com/en-us/powershell/power-bi/overview A collection of cmdlets for retrieving, updating, and managing user access within Power BI workspaces. ```APIDOC ## GET Get-PowerBIWorkspace ### Description Retrieves workspaces assigned to the user or the organization. ### Parameters #### Query Parameters - **-All** (Switch) - Optional - Shows all workspaces instead of the default first 100. - **-Scope** (String) - Optional - Defines access level: 'Individual' (default) or 'Organization' (admin only). ## PUT Set-PowerBIWorkspace ### Description Updates the name or description of a specific workspace. ### Parameters #### Request Body - **-Id** (String) - Required - The unique identifier of the workspace. - **-Name** (String) - Optional - The new name for the workspace. - **-Description** (String) - Optional - The new description for the workspace. - **-Scope** (String) - Optional - Defines access level: 'Individual' or 'Organization'. ## POST Add-PowerBIWorkspaceUser ### Description Adds a user to a specific workspace with defined access rights. ### Parameters #### Request Body - **-Id** (String) - Required - The unique identifier of the workspace. - **-UserEmailAddress** (String) - Required - The email address of the user to add. - **-AccessRight** (String) - Required - The permission level (e.g., Admin). - **-Scope** (String) - Optional - Defines access level: 'Individual' or 'Organization'. ## DELETE Remove-PowerBIWorkspaceUser ### Description Removes a user's permissions from a specific workspace. ### Parameters #### Request Body - **-Id** (String) - Required - The unique identifier of the workspace. - **-UserEmailAddress** (String) - Required - The email address of the user to remove. - **-Scope** (String) - Optional - Defines access level: 'Individual' or 'Organization'. ``` -------------------------------- ### Log in to Power BI Service Source: https://docs.microsoft.com/en-us/powershell/power-bi/overview Connects to the Power BI service to authenticate your session. Aliases like Login-PowerBIServiceAccount and Login-PowerBI are also available. ```PowerShell Connect-PowerBIServiceAccount # or use aliases: Login-PowerBIServiceAccount, Login-PowerBI ``` -------------------------------- ### Export Power BI Reports Source: https://docs.microsoft.com/en-us/powershell/power-bi/overview Export a report to a .pbix file, optionally specifying a workspace ID. ```PowerShell Export-PowerBIReport -Id b48c088c-6f4e-4b7a-b015-d844ab534b2a -OutFile .\exportedReport.pbix ``` ```PowerShell Export-PowerBIReport -Id b48c088c-6f4e-4b7a-b015-d844ab534b2a -OutFile .\exportedReport.pbix -WorkspaceId 3bdd9735-0ab5-4f21-bd5d-87e7f1d7fb84 ``` -------------------------------- ### Retrieve Power BI Reports Source: https://docs.microsoft.com/en-us/powershell/power-bi/overview Commands to fetch reports for the current user or across the entire organization. ```PowerShell Get-PowerBIReport ``` ```PowerShell Get-PowerBIReport -Scope Organization ``` -------------------------------- ### Retrieve Power BI Dashboards Source: https://docs.microsoft.com/en-us/powershell/power-bi/overview Commands to fetch dashboards for the current user or across the entire organization. ```PowerShell Get-PowerBIDashboard ``` ```PowerShell Get-PowerBIDashboard -Scope Organization ``` -------------------------------- ### Interact with Power BI REST API Source: https://docs.microsoft.com/en-us/powershell/power-bi/overview Execute custom REST API requests or retrieve an access token for external use. ```PowerShell Invoke-PowerBIRestMethod -Url 'reports/4eb4c303-d5ac-4a2d-bf1e-39b35075d983/Clone' -Method Post -Body ([pscustomobject]@{name='Cloned report'; targetModelId='adf823b5-a0de-4b9f-bcce-b17d774d2961'; targetWorkspaceId='45ee15a7-0e8e-45b0-8111-ea304ada8d7d'} | ConvertTo-Json -Depth 2 -Compress) ``` ```PowerShell Get-PowerBIAccessToken -AsString ``` -------------------------------- ### Update Workspace Details Source: https://docs.microsoft.com/en-us/powershell/power-bi/overview Modifies the name and description of a specified workspace. Requires the workspace ID and administrator privileges when using -Scope Organization. ```PowerShell Set-PowerBIWorkspace -Scope Organization -Id "3244f1c1-01cf-457f-9383-6035e4950fdc" -Name "Test Name" -Description "Test Description" ``` -------------------------------- ### Troubleshoot Power BI Errors Source: https://docs.microsoft.com/en-us/powershell/power-bi/overview Retrieve details about the last error encountered by the cmdlets. ```PowerShell Resolve-PowerBIError -Last ``` -------------------------------- ### Remove User from Workspace Source: https://docs.microsoft.com/en-us/powershell/power-bi/overview Revokes a user's access permissions from a specified workspace. Requires the workspace ID and the user's email address. ```PowerShell Remove-PowerBIWorkspaceUser -Scope Organization -Id 3244f1c1-01cf-457f-9383-6035e4950fdc -UserEmailAddress john@contoso.com ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.