### PowerShell Example: Create Power BI Tables and Dataset Source: https://github.com/microsoft/powerbi-powershell/blob/master/src/Modules/Data/Commands.Data/help/New-PowerBITable.md This example demonstrates how to create multiple Power BI table objects with columns using `New-PowerBIColumn` and `New-PowerBITable`, then combine them into a dataset with `New-PowerBIDataSet`, and finally add the dataset to Power BI using `Add-PowerBIDataSet`. ```powershell PS C:\>$col1 = New-PowerBIColumn -Name ID -DataType Int64 PS C:\>$col2 = New-PowerBIColumn -Name Data -DataType String PS C:\>$table1 = New-PowerBITable -Name SampleTable1 -Columns $col1,$col2 PS C:\> PS C:\>$col3 = New-PowerBIColumn -Name ID -DataType Int64 PS C:\>$col4 = New-PowerBIColumn -Name Date -DataType DateTime PS C:\>$col5 = New-PowerBIColumn -Name Detail -DataType String PS C:\>$col6 = New-PowerBIColumn -Name Result -DataType Double PS C:\>$table2 = New-PowerBITable -Name SampleTable2 -Columns $col3,$col4,$col5,$col6 PS C:\> PS C:\>$dataset = New-PowerBIDataSet -Name SampleDataSet -Tables $table1,$table2 PS C:\> PS C:\>Add-PowerBIDataSet -DataSet $dataset ``` -------------------------------- ### PowerShell Example: Create and Add Power BI Dataset Source: https://github.com/microsoft/powerbi-powershell/blob/master/src/Modules/Data/Commands.Data/help/Add-PowerBIDataset.md This example demonstrates how to create a Power BI dataset with multiple tables and columns using New-PowerBIColumn, New-PowerBITable, and New-PowerBIDataSet cmdlets, and then publish it to Power BI service using Add-PowerBIDataSet. The dataset will be added to 'My Workspace' by default. ```powershell PS C:\>$col1 = New-PowerBIColumn -Name ID -DataType Int64 PS C:\>$col2 = New-PowerBIColumn -Name Data -DataType String PS C:\>$table1 = New-PowerBITable -Name SampleTable1 -Columns $col1,$col2 PS C:\> PS C:\>$col3 = New-PowerBIColumn -Name ID -DataType Int64 PS C:\>$col4 = New-PowerBIColumn -Name Date -DataType DateTime PS C:\>$col5 = New-PowerBIColumn -Name Detail -DataType String PS C:\>$col6 = New-PowerBIColumn -Name Result -DataType Double PS C:\>$table2 = New-PowerBITable -Name SampleTable2 -Columns $col3,$col4,$col5,$col6 PS C:\> PS C:\>$dataset = New-PowerBIDataSet -Name SampleDataSet -Tables $table1,$table2 PS C:\> PS C:\>Add-PowerBIDataSet -DataSet $dataset ``` -------------------------------- ### Example Usage of Get-PowerBIEncryptionKey Source: https://github.com/microsoft/powerbi-powershell/blob/master/src/Modules/Admin/Commands.Admin/help/Get-PowerBIEncryptionKey.md Demonstrates a basic invocation of the Get-PowerBIEncryptionKey cmdlet to retrieve the tenant's encryption key. This is a straightforward command execution without any specific parameters. ```PowerShell PS C:\> Get-PowerBIEncryptionKey ``` -------------------------------- ### Example: Copy Power BI Tile with Specific IDs Source: https://github.com/microsoft/powerbi-powershell/blob/master/src/Modules/Reports/Commands.Reports/help/Copy-PowerBITile.md Demonstrates how to use `Copy-PowerBITile` to copy a specific tile from one dashboard to another, including specifying target workspace, report, and dataset IDs. This example shows a comprehensive usage scenario for cross-workspace tile copying and rebinding. ```powershell PS C:\> Copy-PowerBITile -DashboardId cff24b2e-faa8-4683-8ecb-2c50e7d2cc7a -TileId e297e105-be30-4482-8531-152cdf289ac6 -TargetDashboardId 8f88d7ab-49e7-41e0-979b-28f063056daa -targetWorkspaceId 166bc04e-da57-426b-b7b4-d24d0e3e5587 -TargetReportId 1fb4359e-9356-4193-9965-a9472a0051b8 -TargetDatasetId a96cd411-4562-4eba-ba2a-42fee8425a87 ``` -------------------------------- ### Get Power BI Workspace Migration Status by ID Source: https://github.com/microsoft/powerbi-powershell/blob/master/src/Modules/Workspaces/Commands.Workspaces/help/Get-PowerBIWorkspaceMigrationStatus.md This example demonstrates how to retrieve the migration status for a specific Power BI workspace by providing its unique identifier (GUID). The cmdlet returns the current migration status of the specified workspace. ```powershell PS C:\> Get-PowerBIWorkspaceMigrationStatus -Id "3244f1c1-01cf-457f-9383-6035e4950fdc" ``` -------------------------------- ### Retrieve Power BI Tables by Dataset ID Example Source: https://github.com/microsoft/powerbi-powershell/blob/master/src/Modules/Data/Commands.Data/help/Get-PowerBITable.md An example demonstrating how to use Get-PowerBITable to retrieve all Power BI tables associated with a specific dataset, identified by its unique GUID. ```powershell PS C:\> Get-PowerBITable -DatasetId eed49d27-8e3c-424d-9342-c6b3ca6db64d ``` -------------------------------- ### New-PowerBITable Cmdlet API Reference Source: https://github.com/microsoft/powerbi-powershell/blob/master/src/Modules/Data/Commands.Data/help/New-PowerBITable.md Detailed API documentation for the `New-PowerBITable` cmdlet, outlining its synopsis, syntax, parameters, and output types for creating Power BI table objects. ```APIDOC New-PowerBITable: SYNOPSIS: Creates a new Power BI table object. SYNTAX: New-PowerBITable -Name [-Columns ] [] DESCRIPTION: Initiates the creation of a new Power BI table object. A table is a container for columns and rows, and contained within datasets. PARAMETERS: -Columns: Type: Column[] Description: An array of column objects. Required: False Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False -Name: Type: String Description: Name of the table. Required: True Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False CommonParameters: This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216). INPUTS: None OUTPUTS: Microsoft.PowerBI.Common.Api.Datasets.Table ``` -------------------------------- ### Invoke Power BI REST Method with GET Request Source: https://github.com/microsoft/powerbi-powershell/blob/master/src/Modules/Profile/Commands.Profile/help/Invoke-PowerBIRestMethod.md Demonstrates how to use `Invoke-PowerBIRestMethod` to perform a GET request against the 'groups' endpoint in the Power BI service. This example fetches information about Power BI groups. ```PowerShell PS C:\> Invoke-PowerBIRestMethod -Url 'groups' -Method Get ``` -------------------------------- ### Example: Get Power BI Access Token and Use with Invoke-RestMethod Source: https://github.com/microsoft/powerbi-powershell/blob/master/src/Modules/Profile/Commands.Profile/help/Get-PowerBIAccessToken.md This example demonstrates how to retrieve the Power BI access token using Get-PowerBIAccessToken and then pass it as a header to Invoke-RestMethod to authenticate and interact with a Power BI API endpoint, such as listing groups. ```PowerShell PS C:\> $headers = Get-PowerBIAccessToken PS C:\> Invoke-RestMethod -Headers $headers -Uri 'https://api.powerbi.com/v1.0/myorg/groups' ``` -------------------------------- ### Add Power BI Workspace User Example Source: https://github.com/microsoft/powerbi-powershell/blob/master/src/Modules/Workspaces/Commands.Workspaces/help/Add-PowerBIWorkspaceUser.md This example demonstrates how to use the `Add-PowerBIWorkspaceUser` cmdlet to grant 'Admin' access to a user with the email 'john@contoso.com' for a specific Power BI workspace identified by its GUID '23FCBDBD-A979-45D8-B1C8-6D21E0F4BE50', operating within the organization scope. ```powershell PS C:\> Add-PowerBIWorkspaceUser -Scope Organization -Id 23FCBDBD-A979-45D8-B1C8-6D21E0F4BE50 -UserEmailAddress john@contoso.com -AccessRight Admin ``` -------------------------------- ### Copy-PowerBITile Cmdlet Parameters Source: https://github.com/microsoft/powerbi-powershell/blob/master/src/Modules/Reports/Commands.Reports/help/Copy-PowerBITile.md Details all available parameters for the `Copy-PowerBITile` cmdlet, including their types, whether they are required, aliases, and descriptions. This section provides comprehensive information for each parameter to guide proper usage. ```APIDOC -DashboardId The ID of the dashboard where source tile is located. Type: String Parameter Sets: (All) Aliases: DashboardKey Required: True Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False -PositionConflictAction Optional parameter for specifying the action in case of position conflict. The default is 'Tail'. Type: String Parameter Sets: (All) Aliases: Required: False Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False -TargetDashboardId The ID of the dashboard where tile copy should be added. Type: String Parameter Sets: (All) Aliases: Required: True Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False -TargetDatasetId Optional parameter to rebind the copied tile to a different dataset. Type: String Parameter Sets: (All) Aliases: TargetModelId Required: False Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False -TargetReportId Optional parameter to rebind the copied tile to a different report. Type: String Parameter Sets: (All) Aliases: Required: False Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False -TargetWorkspaceId Optional parameter for specifying the target workspace ID. Empty Guid (00000000-0000-0000-0000-000000000000) indicates 'My Workspace'. Empty string indicates tile will be copied within the same workspace. Type: String Parameter Sets: (All) Aliases: TargetGroupId Required: False Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False -TileId The ID of the tile that should be copied Type: String Parameter Sets: (All) Aliases: TileKey Required: True Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False -Workspace Workspace object, as returned by the Get-PowerBIWorkspace cmdlet, where the source dashboard is located. Type: Workspace Parameter Sets: WorkspaceObject Aliases: Group Required: True Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False ``` -------------------------------- ### Get-PowerBITable Cmdlet Parameter Reference Source: https://github.com/microsoft/powerbi-powershell/blob/master/src/Modules/Data/Commands.Data/help/Get-PowerBITable.md Detailed documentation for each parameter of the Get-PowerBITable cmdlet, including type, whether it's required, default values, aliases, and accepted pipeline input. Also includes information on input and output types. ```APIDOC PARAMETERS: -Dataset: Type: Dataset Parameter Sets: Dataset Aliases: Required: True Position: Named Default value: None Accept pipeline input: True (ByValue) Accept wildcard characters: False -DatasetId: Type: Guid Parameter Sets: DatasetId Aliases: Required: True Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False -First: Type: Int32 Parameter Sets: (All) Aliases: Top Required: False Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False -Name: Type: String Parameter Sets: (All) Aliases: Required: False Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False -Scope: Type: PowerBIUserScope Parameter Sets: (All) Aliases: Accepted values: Individual, Organization Required: False Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False -Skip: Type: Int32 Parameter Sets: (All) Aliases: Required: False Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False -Workspace: Type: Workspace Parameter Sets: (All) Aliases: Group Required: False Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False -WorkspaceId: Type: Guid Parameter Sets: (All) Aliases: GroupId Required: False Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False CommonParameters: This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216). INPUTS: Microsoft.PowerBI.Common.Api.Datasets.Dataset OUTPUTS: System.Object ``` -------------------------------- ### Delete Power BI Report by ID and Workspace ID (PowerShell) Source: https://github.com/microsoft/powerbi-powershell/blob/master/src/Modules/Reports/Commands.Reports/help/Remove-PowerBIReport.md This example demonstrates how to delete a specific Power BI report using its GUID and the GUID of the workspace it belongs to. This is useful for targeting reports in shared or specific workspaces, ensuring the correct report is removed from the intended location. ```powershell PS C:\> Remove-PowerBIReport -Id 12345-abc56-jkl56-700a0 -WorkspaceId ccd01-bif87-abc12-34efg ``` -------------------------------- ### Get-PowerBIDashboard Cmdlet Parameter Reference Source: https://github.com/microsoft/powerbi-powershell/blob/master/src/Modules/Reports/Commands.Reports/help/Get-PowerBIDashboard.md Detailed documentation for each parameter supported by the Get-PowerBIDashboard cmdlet, including their types, aliases, whether they are required, default values, and which parameter sets they belong to. ```APIDOC -Filter OData filter, case-sensitive (element names start lowercase). Only supported when -Scope Organization is specified. Type: String Parameter Sets: List, ObjectAndList Aliases: Required: False Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False -First First (top) list of results. Type: Int32 Parameter Sets: List, ObjectAndList Aliases: Top Required: False Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False -Id ID of the dashboard to return. Type: Guid Parameter Sets: Id, ObjectAndId Aliases: ImportId Required: True Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False -Name Name of the dashboard to return if one exists with that name. Case insensitive search. Type: String Parameter Sets: Name, ObjectAndName Aliases: Required: True Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False -Scope Indicates the scope of the call. Individual returns only dashboards assigned to the caller; Organization returns all dashboards within a tenant (must be an administrator to initiate). Individual is the default. Type: PowerBIUserScope Parameter Sets: (All) Aliases: Accepted values: Individual, Organization Required: False Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False -Skip Skips the first set of results. Type: Int32 Parameter Sets: List, ObjectAndList Aliases: Required: False Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False -Workspace Workspace to filter results to; only dashboards that belong to that workspace are shown. Type: Workspace Parameter Sets: ObjectAndId, ObjectAndName, ObjectAndList Aliases: Group Required: True Position: Named Default value: None Accept pipeline input: True (ByValue) Accept wildcard characters: False -WorkspaceId ID of the workspace to filter results to; only dashboards that belong to that workspace are shown. Type: Guid Parameter Sets: List, Id, Name Aliases: GroupId Required: False Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False CommonParameters This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216). ``` -------------------------------- ### Get All Power BI Reports for User Source: https://github.com/microsoft/powerbi-powershell/blob/master/src/Modules/Reports/Commands.Reports/help/Get-PowerBIReport.md This example demonstrates how to retrieve a list of all Power BI reports that the current user has access to, using the default scope (Individual). ```powershell PS C:\> Get-PowerBIReport ``` -------------------------------- ### Get Power BI Encryption Key Cmdlet Source: https://github.com/microsoft/powerbi-powershell/blob/master/src/Modules/Admin/Commands.Admin/help/MicrosoftPowerBIMgmt.Admin.md Retrieves the encryption key configured for the Power BI tenant. This cmdlet helps in verifying the current encryption setup. ```APIDOC Get-PowerBIEncryptionKey ``` -------------------------------- ### Create and Add Power BI Dataset with Multiple Tables and Columns (PowerShell) Source: https://github.com/microsoft/powerbi-powershell/blob/master/src/Modules/Data/Commands.Data/help/New-PowerBIDataset.md This example demonstrates how to create a Power BI dataset object in PowerShell, including defining columns and tables, and then adding the dataset to Power BI. It shows the instantiation of two tables with different column structures and their subsequent inclusion in a dataset, which is then published to Power BI. ```powershell PS C:\>$col1 = New-PowerBIColumn -Name ID -DataType Int64 PS C:\>$col2 = New-PowerBIColumn -Name Data -DataType String PS C:\>$table1 = New-PowerBITable -Name SampleTable1 -Columns $col1,$col2 PS C:\> PS C:\>$col3 = New-PowerBIColumn -Name ID -DataType Int64 PS C:\>$col4 = New-PowerBIColumn -Name Date -DataType DateTime PS C:\>$col5 = New-PowerBIColumn -Name Detail -DataType String PS C:\>$col6 = New-PowerBIColumn -Name Result -DataType Double PS C:\>$table2 = New-PowerBITable -Name SampleTable2 -Columns $col3,$col4,$col5,$col6 PS C:\> PS C:\>$dataset = New-PowerBIDataSet -Name SampleDataSet -Tables $table1,$table2 PS C:\> PS C:\>Add-PowerBIDataSet -DataSet $dataset ``` -------------------------------- ### New-PowerBIDashboard Cmdlet Parameters Source: https://github.com/microsoft/powerbi-powershell/blob/master/src/Modules/Reports/Commands.Reports/help/New-PowerBIDashboard.md Details the parameters available for the New-PowerBIDashboard cmdlet, including their types, whether they are required, and their accepted values or aliases. This section provides comprehensive information for each parameter. ```APIDOC -Name Name of the dashboard. Type: String Parameter Sets: (All) Aliases: Required: True Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False -Workspace Workspace object, as returned by the Get-PowerBIWorkspace cmdlet, in which the dashboard should be created. Type: Workspace Parameter Sets: NameAndObject Aliases: Group Required: True Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False -WorkspaceId ID of the workspace in which the dashboard should be created. Type: Guid Parameter Sets: NameAndIds Aliases: GroupId Required: True Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False CommonParameters This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216). ``` -------------------------------- ### Get All Power BI Reports for Organization Source: https://github.com/microsoft/powerbi-powershell/blob/master/src/Modules/Reports/Commands.Reports/help/Get-PowerBIReport.md This example shows how to retrieve a list of all Power BI reports within the user's organization. This operation typically requires administrative permissions. ```powershell PS C:\> Get-PowerBIReport -Scope Organization ``` -------------------------------- ### Get All Power BI Data Sources by Dataset ID Source: https://github.com/microsoft/powerbi-powershell/blob/master/src/Modules/Data/Commands.Data/help/Get-PowerBIDatasource.md This example demonstrates how to retrieve all data sources within a specific Power BI dataset using its ID, accessible to the calling user. ```PowerShell PS C:\> Get-PowerBIDatasource -DatasetId 23d088a0-a395-483e-b81c-54f51f3e4e3c ``` -------------------------------- ### Get-PowerBITable Cmdlet Syntax Overview Source: https://github.com/microsoft/powerbi-powershell/blob/master/src/Modules/Data/Commands.Data/help/Get-PowerBITable.md Provides the full syntax definitions for the Get-PowerBITable cmdlet, illustrating the two main parameter sets: one accepting a DatasetId and another accepting a Dataset object. ```APIDOC Get-PowerBITable -DatasetId [-Name ] [-Scope ] [-First ] [-Skip ] [-WorkspaceId ] [-Workspace ] [] Get-PowerBITable -Dataset [-Name ] [-Scope ] [-First ] [-Skip ] [-WorkspaceId ] [-Workspace ] [] ``` -------------------------------- ### Get All Power BI Data Sources by Dataset ID with Organization Scope Source: https://github.com/microsoft/powerbi-powershell/blob/master/src/Modules/Data/Commands.Data/help/Get-PowerBIDatasource.md This example shows how to retrieve all data sources within a specific Power BI dataset across the entire organization, requiring administrator privileges. ```PowerShell PS C:\> Get-PowerBIDatasource -DatasetId 23d088a0-a395-483e-b81c-54f51f3e4e3c -Scope Organization ``` -------------------------------- ### Add-PowerBIWorkspaceUser Cmdlet Parameters Source: https://github.com/microsoft/powerbi-powershell/blob/master/src/Modules/Workspaces/Commands.Workspaces/help/Add-PowerBIWorkspaceUser.md Detailed documentation for all parameters of the `Add-PowerBIWorkspaceUser` cmdlet, including their types, descriptions, accepted values, and applicability to different parameter sets. This section covers `AccessRight`, `Id`, `Identifier`, `PrincipalType`, `Scope`, `UserPrincipalName`, and `Workspace`, along with common parameters. ```APIDOC -AccessRight Permissions to assign to the user. Type: WorkspaceUserAccessRight Parameter Sets: (All) Aliases: UserAccessRight Accepted values: Member, Admin, Contributor, Viewer Required: True Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False -Id ID of the workspace the user should be added to. Type: Guid Parameter Sets: UserEmailWithId, PrincipalTypeWithId Aliases: GroupId, WorkspaceId Required: True Position: Named Default value: None Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False -Identifier Identifier of the principal to add to the group. For Apps and Groups, this will be their object identifier (GUID). For users, this can be an email address. Type: String Parameter Sets: PrincipalTypeWithId, PrincipalTypeWithWorkspace Aliases: PrincipalId Required: True Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False -PrincipalType The type of the principal to add to the group. Type: WorkspaceUserPrincipalType Parameter Sets: PrincipalTypeWithId, PrincipalTypeWithWorkspace Aliases: Accepted values: App, Group, User Required: True Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False -Scope Indicates scope of the call. Individual operates against only workspaces assigned to the caller; Organization operates against all workspaces within a tenant (must be an administrator to initiate). Individual is the default. Type: PowerBIUserScope Parameter Sets: (All) Aliases: Accepted values: Individual, Organization Required: False Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False -UserPrincipalName User Principal Name (or UPN, commonly an email address) for the user whose permissions need to be added. Type: String Parameter Sets: UserEmailWithId, UserEmailWithWorkspace Aliases: UserEmailAddress Required: True Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False -Workspace The workspace entity to add the user to. Type: Workspace Parameter Sets: UserEmailWithWorkspace, PrincipalTypeWithWorkspace Aliases: Group Required: True Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False CommonParameters This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216). ``` -------------------------------- ### Switch-PowerBIEncryptionKey Cmdlet Syntax Source: https://github.com/microsoft/powerbi-powershell/blob/master/src/Modules/Admin/Commands.Admin/help/Switch-PowerBIEncryptionKey.md Shows the standard syntax for invoking the `Switch-PowerBIEncryptionKey` cmdlet, detailing its required parameters and the inclusion of common PowerShell parameters. ```PowerShell Switch-PowerBIEncryptionKey -Name -KeyVaultKeyUri [] ``` -------------------------------- ### Get Power BI Tiles for a Dashboard (Organization Scope) Source: https://github.com/microsoft/powerbi-powershell/blob/master/src/Modules/Reports/Commands.Reports/help/Get-PowerBITile.md This example retrieves a list of Power BI tiles from a specified dashboard, explicitly setting the scope to 'Organization'. This is useful for administrators to view all tiles within a tenant, provided they have the necessary permissions. ```powershell PS C:\> Get-PowerBITile -DashboardId 6b071d0b-7430-4342-a3a6-d5c0fac130e4 -Scope Organization ``` -------------------------------- ### New-PowerBIWorkspace Cmdlet Syntax Source: https://github.com/microsoft/powerbi-powershell/blob/master/src/Modules/Workspaces/Commands.Workspaces/help/New-PowerBIWorkspace.md Defines the command-line syntax for the New-PowerBIWorkspace cmdlet, showing required and optional parameters for creating a new Power BI workspace. ```APIDOC New-PowerBIWorkspace -Name [] ``` -------------------------------- ### Export Power BI Report to PBIX File Source: https://github.com/microsoft/powerbi-powershell/blob/master/src/Modules/Reports/Commands.Reports/help/Export-PowerBIReport.md This example demonstrates how to use Export-PowerBIReport to save a specific Power BI report, identified by its GUID, to a local .pbix file. The output file will be named 'Sales.pbix' and saved in the current working directory. ```powershell PS C:\> Export-PowerBIReport -Id 9b519499-5ba1-4f1c-878b-be3a69f1791f -OutFile .\Sales.pbix ``` -------------------------------- ### New-PowerBIDashboard Cmdlet Source: https://github.com/microsoft/powerbi-powershell/blob/master/src/Modules/Reports/Commands.Reports/help/MicrosoftPowerBIMgmt.Reports.md API documentation for the New-PowerBIDashboard cmdlet, used to create a new empty Power BI dashboard. ```APIDOC New-PowerBIDashboard Description: Creates a new empty Power BI dashboard. ``` -------------------------------- ### Connect to Power BI Service using Service Principal with Certificate Source: https://github.com/microsoft/powerbi-powershell/blob/master/src/Modules/Profile/Commands.Profile/help/Connect-PowerBIServiceAccount.md This example demonstrates how to log in to the Power BI service using a service principal authenticated by an installed certificate. The certificate must have a private key and be located in either the CurrentUser or LocalMachine store. ```PowerShell PS C:\> Connect-PowerBIServiceAccount -ServicePrincipal -CertificateThumbprint 38DA4BED389A014E69A6E6D8AE56761E85F0DFA4 -ApplicationId b5fde143-722c-4e8d-8113-5b33a9291468 ``` -------------------------------- ### Get Power BI Tiles for a Dashboard (Default Scope) Source: https://github.com/microsoft/powerbi-powershell/blob/master/src/Modules/Reports/Commands.Reports/help/Get-PowerBITile.md This example retrieves a list of Power BI tiles from a specified dashboard using its ID. It demonstrates the basic usage of Get-PowerBITile without explicitly setting a scope, defaulting to tiles accessible by the current user. ```powershell PS C:\> Get-PowerBITile -DashboardId 6b071d0b-7430-4342-a3a6-d5c0fac130e4 ``` -------------------------------- ### Connect to Power BI Service in China Cloud Source: https://github.com/microsoft/powerbi-powershell/blob/master/src/Modules/Profile/Commands.Profile/help/Connect-PowerBIServiceAccount.md This example shows how to log in to the Power BI service specifically targeting the China cloud environment using user authentication. A credential prompt will be displayed. ```PowerShell PS C:\> Connect-PowerBIServiceAccount -Environment China ``` -------------------------------- ### Delete Power BI Report by ID from My Workspace (PowerShell) Source: https://github.com/microsoft/powerbi-powershell/blob/master/src/Modules/Reports/Commands.Reports/help/Remove-PowerBIReport.md This example shows how to delete a Power BI report from your personal 'My Workspace' by providing only the report's GUID. This is the default behavior when no workspace identifier is specified, simplifying the command for personal report management. ```powershell PS C:\> Remove-PowerBIReport -Id 12345-abc56-jkl56-700a0 ``` -------------------------------- ### New-PowerBIDashboard Cmdlet Syntax Source: https://github.com/microsoft/powerbi-powershell/blob/master/src/Modules/Reports/Commands.Reports/help/New-PowerBIDashboard.md Defines the various syntax forms for the New-PowerBIDashboard cmdlet, including parameter sets for creating a dashboard by name only, with a workspace ID, or with a workspace object. ```APIDOC NameOnly (Default) New-PowerBIDashboard -Name [] NameAndIds New-PowerBIDashboard -Name -WorkspaceId [] NameAndObject New-PowerBIDashboard -Name -Workspace [] ``` -------------------------------- ### Retrieve Power BI Activity Events for a Specific Time Range Source: https://github.com/microsoft/powerbi-powershell/blob/master/src/Modules/Admin/Commands.Admin/help/Get-PowerBIActivityEvent.md This example demonstrates how to retrieve all Power BI activity events within a specified start and end date/time range. Both dates must be in UTC and ISO 8601 compliant, and fall within the same UTC day. ```powershell PS C:\> Get-PowerBIActivityEvent -StartDateTime 2019-08-10T14:35:20 -EndDateTime 2019-08-10T18:25:50 ``` -------------------------------- ### Switch-PowerBIEncryptionKey Cmdlet API Reference Source: https://github.com/microsoft/powerbi-powershell/blob/master/src/Modules/Admin/Commands.Admin/help/Switch-PowerBIEncryptionKey.md Detailed API documentation for the `Switch-PowerBIEncryptionKey` cmdlet, outlining its purpose, operational requirements, and comprehensive specifications for all parameters, input types, and output types. ```APIDOC Switch-PowerBIEncryptionKey: Synopsis: Switch the encryption key for Power BI workspaces assigned to a capacity. Description: Rotate the customer owned key for the tenant. Make sure the current encryption key and new version of key is valid. Grant wrap and unwrap key permissions for Power BI service in the Azure Key Vault. Before you run this command, make sure you log in using Connect-PowerBIServiceAccount. This cmdlet requires the calling user to be a tenant administrator of the Power BI service. Parameters: - Name: KeyVaultKeyUri Type: String Parameter Sets: (All) Aliases: Required: True Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False Description: Uri to the version of the "Azure Key Vault" key to be used. Only supports 4096 bytes key. - Name: Name Type: String Parameter Sets: (All) Aliases: Required: True Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False Description: The name of the encryption key. - Name: CommonParameters Description: This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216). Inputs: None Outputs: Microsoft.PowerBI.Common.Api.Encryption.EncryptionKey ``` -------------------------------- ### Install Microsoft Power BI Management PowerShell Module Source: https://github.com/microsoft/powerbi-powershell/blob/master/README.md Installs the main rollup module for Power BI cmdlets from PowerShell Gallery. This module consolidates various Power BI functionalities. An elevated PowerShell session is required for installation. ```PowerShell Install-Module -Name MicrosoftPowerBIMgmt ``` -------------------------------- ### Restore-PowerBIWorkspace Cmdlet Parameters Source: https://github.com/microsoft/powerbi-powershell/blob/master/src/Modules/Workspaces/Commands.Workspaces/help/Restore-PowerBIWorkspace.md Detailed documentation for each parameter of the `Restore-PowerBIWorkspace` cmdlet, including type, requirements, aliases, and accepted values for proper usage. ```APIDOC -AdminUserPrincipalName (Type: String) Description: User Principal Name (or UPN, commonly an email address) of the user who will become the admin of the restored workspace. Parameter Sets: (All) Aliases: AdminEmailAddress Required: True Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False -Id (Type: Guid) Description: ID of the workspace to restore. Parameter Sets: Id Aliases: GroupId, WorkspaceId Required: True Position: Named Default value: None Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False -RestoredName (Type: String) Description: An optional new name to give to the restored workspace. Parameter Sets: (All) Aliases: Required: False Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False -Scope (Type: PowerBIUserScope) Description: Indicates scope of the call. Individual is not supported; Organization can restore any deleted workspaces within a tenant (must be an administrator to initiate) unless the workspace met its data retention policy and completed removal. Organization is the default. Parameter Sets: (All) Aliases: Accepted values: Individual, Organization Required: False Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False -Workspace (Type: Workspace) Description: The workspace entity to be restored. Parameter Sets: Workspace Aliases: Group Required: True Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False CommonParameters: Description: This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216). ```