{"id":13638256,"url":"https://github.com/microsoft/powerbi-powershell","last_synced_at":"2025-05-16T03:06:01.739Z","repository":{"id":30618154,"uuid":"123018180","full_name":"microsoft/powerbi-powershell","owner":"microsoft","description":"PowerShell community for Microsoft PowerBI. Here you will find resources and source for PowerShell modules targeting PowerBI.","archived":false,"fork":false,"pushed_at":"2025-04-30T23:52:10.000Z","size":1407,"stargazers_count":369,"open_issues_count":175,"forks_count":128,"subscribers_count":55,"default_branch":"master","last_synced_at":"2025-05-01T14:01:51.722Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/microsoft.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":"ROADMAP.md","authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-02-26T19:16:45.000Z","updated_at":"2025-05-01T10:49:41.000Z","dependencies_parsed_at":"2025-05-01T11:59:56.386Z","dependency_job_id":null,"html_url":"https://github.com/microsoft/powerbi-powershell","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoft%2Fpowerbi-powershell","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoft%2Fpowerbi-powershell/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoft%2Fpowerbi-powershell/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoft%2Fpowerbi-powershell/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/microsoft","download_url":"https://codeload.github.com/microsoft/powerbi-powershell/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254459088,"owners_count":22074605,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T01:00:42.999Z","updated_at":"2025-05-16T03:05:56.731Z","avatar_url":"https://github.com/microsoft.png","language":"C#","funding_links":[],"categories":["C# #"],"sub_categories":[],"readme":"# Microsoft Power BI Cmdlets for Windows PowerShell and PowerShell Core\n\nWelcome to the PowerShell community for Microsoft Power BI. Here you will find resources and source for PowerShell modules targeting PowerBI.\n\nFor questions or issues using the modules, please log an issue and we will respond as quickly as possible.\n\n## PowerShell modules\n\nBelow is a table of the various Power BI PowerShell modules found in this repository.\n\n| Description | Module Name | PowerShell Gallery link |\n| ----------- | ----------- | ----------------------- |\n| Rollup Module for Power BI Cmdlets | `MicrosoftPowerBIMgmt` | [![MicrosoftPowerBIMgmt](https://img.shields.io/powershellgallery/v/MicrosoftPowerBIMgmt.svg?style=flat-square\u0026label=MicrosoftPowerBIMgmt)](https://www.powershellgallery.com/packages/MicrosoftPowerBIMgmt/) |\n| Admin module for Power BI | [MicrosoftPowerBIMgmt.Admin](https://docs.microsoft.com/en-us/powershell/module/microsoftpowerbimgmt.admin) | [![MicrosoftPowerBIMgmt.Admin](https://img.shields.io/powershellgallery/v/MicrosoftPowerBIMgmt.Admin.svg?style=flat-square\u0026label=MicrosoftPowerBIMgmt.Admin)](https://www.powershellgallery.com/packages/MicrosoftPowerBIMgmt.Admin/) |\n| Capacities module for Power BI | [MicrosoftPowerBIMgmt.Capacities](https://docs.microsoft.com/en-us/powershell/module/microsoftpowerbimgmt.capacities) | [![MicrosoftPowerBIMgmt.Capacities](https://img.shields.io/powershellgallery/v/MicrosoftPowerBIMgmt.Capacities.svg?style=flat-square\u0026label=MicrosoftPowerBIMgmt.Capacities)](https://www.powershellgallery.com/packages/MicrosoftPowerBIMgmt.Capacities/) |\n| Data module for Power BI | [MicrosoftPowerBIMgmt.Data](https://docs.microsoft.com/en-us/powershell/module/microsoftpowerbimgmt.data) | [![MicrosoftPowerBIMgmt.Data](https://img.shields.io/powershellgallery/v/MicrosoftPowerBIMgmt.Data.svg?style=flat-square\u0026label=MicrosoftPowerBIMgmt.Data)](https://www.powershellgallery.com/packages/MicrosoftPowerBIMgmt.Data/) |\n| Profile module for Power BI | [MicrosoftPowerBIMgmt.Profile](https://docs.microsoft.com/en-us/powershell/module/microsoftpowerbimgmt.profile) | [![MicrosoftPowerBIMgmt.Profile](https://img.shields.io/powershellgallery/v/MicrosoftPowerBIMgmt.Profile.svg?style=flat-square\u0026label=MicrosoftPowerBIMgmt.Profile)](https://www.powershellgallery.com/packages/MicrosoftPowerBIMgmt.Profile/) |\n| Reports module for Power BI | [MicrosoftPowerBIMgmt.Reports](https://docs.microsoft.com/en-us/powershell/module/microsoftpowerbimgmt.reports) | [![MicrosoftPowerBIMgmt.Reports](https://img.shields.io/powershellgallery/v/MicrosoftPowerBIMgmt.Reports.svg?style=flat-square\u0026label=MicrosoftPowerBIMgmt.Reports)](https://www.powershellgallery.com/packages/MicrosoftPowerBIMgmt.Reports/) |\n| Workspaces module for Power BI | [MicrosoftPowerBIMgmt.Workspaces](https://docs.microsoft.com/en-us/powershell/module/microsoftpowerbimgmt.workspaces) | [![MicrosoftPowerBIMgmt.Workspaces](https://img.shields.io/powershellgallery/v/MicrosoftPowerBIMgmt.Workspaces.svg?style=flat-square\u0026label=MicrosoftPowerBIMgmt.Workspaces)](https://www.powershellgallery.com/packages/MicrosoftPowerBIMgmt.Workspaces/) |\n\nMore documentation can be found at https://docs.microsoft.com/en-us/powershell/power-bi/overview.\n\n## Supported environments and PowerShell versions\n\n* Windows PowerShell v3.0 and up with .NET 4.7.1 or above.\n* PowerShell Core (v6) and up on any OS platform supported by PowerShell Core.\n\n## Installation\n\nThe cmdlets are available on PowerShell Gallery and can be installed in an elevated PowerShell session:\n\n```powershell\nInstall-Module -Name MicrosoftPowerBIMgmt\n```\n\nOptionally you could install individual modules (based on your needs) instead of the rollup module, for example if you only wanted the Workspaces module:\n\n```powershell\nInstall-Module -Name MicrosoftPowerBIMgmt.Workspaces\n```\n\nIf you have an earlier version, you can update to the latest version by running:\n\n```powershell\nUpdate-Module -Name MicrosoftPowerBIMgmt\n```\n\n### Uninstall\n\nIf you want to uninstall all the Power BI PowerShell cmdlets, run the following in an elevated PowerShell session:\n\n```powershell\nGet-Module MicrosoftPowerBIMgmt* -ListAvailable | Uninstall-Module -Force\n```\n\n## Usage\n\n\u003eTwo scopes are supported by cmdlets that interact with Power BI entities:\n\u003e * Individual is used to access entities that belong to the current user.\n\u003e * Organization is used to access entities across the entire company. Only Power BI tenant admins are allowed to use.\n\nIf the `-Scope` parameter doesn't exist on the cmdlet, the entity doesn't support an Administrative API.\n\n### Log in to Power BI\n\n```powershell\nConnect-PowerBIServiceAccount   # or use aliases: Login-PowerBIServiceAccount, Login-PowerBI\n```\n\nUse the `Environment` parameter if you need other than Public, which is default. Options are Germany, USGov, China, USGovHigh, USGovMil.\n\n```powershell\nConnect-PowerBIServiceAccount -Environment China\n```\n\n### Get workspaces\n\nGet workspaces for the user. By default (i.e. without `-First` parameter) it shows the first 100 workspaces assigned to the user:\n\n```powershell\nGet-PowerBIWorkspace\n```\n\nUse the `-All` parameter to show all workspaces assigned to the user:\n\n```powershell\nGet-PowerBIWorkspace -All\n```\n\nIf you are a tenant administrator, you can view all workspaces in your tenant by adding `-Scope Organization`:\n\n```powershell\nGet-PowerBIWorkspace -Scope Organization -All\n```\n\n### Update workspace\n\nUpdate the name or description of a user's workspace:\n\n```powershell\nSet-PowerBIWorkspace -Scope Organization -Id \"3244f1c1-01cf-457f-9383-6035e4950fdc\" -Name \"Test Name\" -Description \"Test Description\"\n```\n\n### Add new user to workspace\n\nAdd a user to a given workspace:\n\n```powershell\nAdd-PowerBIWorkspaceUser -Scope Organization -Id 3244f1c1-01cf-457f-9383-6035e4950fdc -UserEmailAddress john@contoso.com -AccessRight Admin\n```\n\n### Add new service principal to workspace\n\nAdd a service principal to a given workspace:\n\n```powershell\nAdd-PowerBIWorkspaceUser -WorkspaceId 3244f1c1-01cf-457f-9383-6035e4950fdc -Identifier \"09934a8f-5066-44b2-91a6-f4987c76ae9e\" -AccessRight Contributor -PrincipalType App\n```\n\n### Add new group to workspace\n\nAdd a group to a given workspace:\n\n```powershell\nAdd-PowerBIWorkspaceUser -WorkspaceId 3244f1c1-01cf-457f-9383-6035e4950fdc -Identifier \"ddc3ecc2-e17e-4353-9b42-964b55500e0f\" -AccessRight Contributor -PrincipalType Group\n```\n\n### Remove a user from a given workspace\n\nRemove user's permissions from a given workspace:\n\n```powershell\nRemove-PowerBIWorkspaceUser -Scope Organization -Id 3244f1c1-01cf-457f-9383-6035e4950fdc -UserEmailAddress john@contoso.com\n```\n\n### Get workspace migration status\n\nGet Power BI workspace migration status:\n\n```powershell\nGet-PowerBIWorkspaceMigrationStatus -Id 038f9a64-1fcd-42f2-957a-13a63b3d3235\n```\n\n### Restore workspace\n\nTo view deleted workspaces as a tenant administrator:\n\n```powershell\nGet-PowerBIWorkspace -Scope Organization -Deleted -All\n```\n\nRestores a deleted workspace:\n\n```powershell\nRestore-PowerBIWorkspace -Id \"3244f1c1-01cf-457f-9383-6035e4950fdc\" -RestoredName \"TestWorkspace\" -AdminEmailAddress \"john@contoso.com\"\n```\n\n### Recover orphaned workspaces\n\nA workspace becomes orphaned when it has no assigned administrators. If you are a tenant administrator, run the following to view all orphaned workspaces:\n\n```powershell\nGet-PowerBIWorkspace -Scope Organization -Orphaned -All\n```\n\nTo correct this issue, use:\n\n```powershell\nAdd-PowerBIWorkspaceUser -Scope Organization -Id f2a0fae5-1c37-4ee6-97da-c9d31851fe17 -UserPrincipalName 'john@contoso.com' -AccessRight Admin\n```\n\n### Get reports\n\nGet all reports for the user:\n\n```powershell\nGet-PowerBIReport\n```\n\nIf you are a tenant administrator, you can view all reports in your tenant by using assigning `-Scope Organization`:\n\n```powershell\nGet-PowerBIReport -Scope Organization\n```\n\n### Get dashboards\n\nGet dashboards for the user:\n\n```powershell\nGet-PowerBIDashboard\n```\n\nIf you are a tenant administrator, you can view all dashboards in your tenant by adding `-Scope Organization`:\n\n```powershell\nGet-PowerBIDashboard -Scope Organization\n```\n\n### Get tiles\n\nGet tiles within a dashboard:\n\n```powershell\nGet-PowerBITile -DashboardId 9a58d5e5-61bc-447c-86c4-e221128b1c99\n```\n\n### Get imports\n\nGet Power BI imports:\n\n```powershell\nGet-PowerBIImport\n```\n\n### Create report\n\nCreate a report in Power BI by uploading a \\*.pbix file:\n\n```powershell\nNew-PowerBIReport -Path .\\newReport.pbix -Name 'New Report'\n```\n\nBy default, the report is placed in the user's My Workspace. To place in a different workspace, use the `-WorkspaceId` or `-Workspace` parameters:\n\n```powershell\nNew-PowerBIReport -Path .\\newReport.pbix -Name 'New Report' -WorkspaceId f95755a1-950c-46bd-a912-5aab4012a06d\n```\n\n### Export report\n\nExport a Power BI report to \\*.pbix file:\n\n```powershell\nExport-PowerBIReport -Id b48c088c-6f4e-4b7a-b015-d844ab534b2a -OutFile .\\exportedReport.pbix\n```\n\nIf the workspace exists outside the My Workspace, export with the `WorkspaceId` or `-Workspace` parameter:\n\n```powershell\nExport-PowerBIReport -Id b48c088c-6f4e-4b7a-b015-d844ab534b2a -OutFile .\\exportedReport.pbix -WorkspaceId 3bdd9735-0ab5-4f21-bd5d-87e7f1d7fb84\n```\n\n### Get datasets\n\nGet Power BI datasets:\n\n```powershell\nGet-PowerBIDataset\n```\n\n### Update dataset storage mode\n\nSet Power BI dataset to use Premium Files for storage mode:\n\n```powershell\nSet-PowerBIDataset -Id 038f9a64-1fcd-42f2-957a-13a63b3d3235 -TargetStorageMode PremiumFiles\n```\n\n### Get datasources\n\nGet Power BI datasources for a dataset:\n\n```powershell\nGet-PowerBIDatasource -DatasetId 65d7d7e5-8af0-4e94-b20b-50a882ae15e1\n```\n\n### Get tables\n\nGet Power BI tables contained within a dataset:\n\n```powershell\nGet-PowerBITable -DatasetId 65d7d7e5-8af0-4e94-b20b-50a882ae15e1\n```\n\n### Call the Power BI Rest API\n\nFor [Power BI API](https://docs.microsoft.com/en-us/rest/api/power-bi/) that lacks corresponding cmdlets, you can reuse the authenticated session from `Connect-PowerBIServiceAccount` to make custom REST requests:\n\n```powershell\nInvoke-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)\n```\n\nIf you want to use the authenticated session outside of PowerShell, get the access token by using:\n\n```powershell\nGet-PowerBIAccessToken -AsString\n```\n\n### Troubleshooting errors\n\nTo get more information about an error returned back from the cmdlets, use:\n\n```powershell\nResolve-PowerBIError -Last\n```\n\nThis information can be useful for opening support tickets for Power BI.\n\n## Issues and feedback\n\nIf you find any bugs or would like to see certain functionality implemented for the PowerShell Cmdlets for Power BI, please file an issue [here](https://github.com/Microsoft/powerbi-powershell/issues). If the issue is an error returned from the cmdlets, add detail from `Resolve-PowerBIError` to the issue.\n\nIf your issue is broader than just the PowerShell cmdlets, please submit your feedback to the [Power BI Community](https://community.powerbi.com/) or the official [Power BI Support](https://powerbi.microsoft.com/en-us/support/) site.\n\nWe track our roadmap of planned features in [ROADMAP.md](ROADMAP.md).\n\n### Reporting security issues\n\nSecurity issues and bugs should be reported privately, via email, to the Microsoft Security Response Center (MSRC) at [secure@microsoft.com](mailto:secure@microsoft.com).\n\nYou should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message.\nFurther information, including the [MSRC PGP](https://technet.microsoft.com/en-us/security/dn606155) key, can be found in the [Security TechCenter](https://technet.microsoft.com/en-us/security/default).\n\n## Contributing\n\nThis project welcomes contributions and suggestions.  Most contributions require you to agree to a\nContributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us\nthe rights to use your contribution. For details, visit https://cla.microsoft.com.\n\nWhen you submit a pull request, a CLA-bot will automatically determine whether you need to provide\na CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions\nprovided by the bot. You will only need to do this once across all repos using our CLA.\n\nThis project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).\nFor more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or\ncontact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.\n\nMore information about contributing can be found in this [CONTRIBUTING](CONTRIBUTING.md) guide.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicrosoft%2Fpowerbi-powershell","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmicrosoft%2Fpowerbi-powershell","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicrosoft%2Fpowerbi-powershell/lists"}