├── .config └── dotnet-tools.json ├── .devcontainer └── devcontainer.json ├── .editorconfig ├── .gitattributes ├── .github └── workflows │ ├── codeql.yml │ ├── package.yml │ └── pr.yml ├── .gitignore ├── .vscode ├── extensions.json ├── launch.json ├── settings.json └── tasks.json ├── CONTRIBUTING.md ├── Directory.Build.props ├── Directory.Build.rsp ├── Directory.Build.targets ├── Directory.Packages.props ├── LICENSE ├── NuGet.config ├── README.md ├── ROADMAP.md ├── ReleaseNotes.md ├── SECURITY.md ├── ThirdPartyNotices.txt ├── build ├── 35MSSharedLib1024.snk ├── Microsoft.PowerBI.Build.targets ├── Microsoft.PowerBI.CodeSign.targets ├── Microsoft.PowerBI.Packaging.targets └── osscg-cart-overrides.json ├── dirs.proj ├── examples ├── CopyWorkspaceSampleScript.ps1 ├── Export-RefreshHistory.ps1 ├── GetPowerBIActivityEvents.ps1 ├── MigrateUsersToPro.ps1 └── dataflows │ ├── DFUtils.psm1 │ ├── ExportWorkspace.ps1 │ ├── Graph.psm1 │ ├── ImportModel.ps1 │ ├── ImportWorkspace.ps1 │ ├── README.md │ ├── RefreshModel.ps1 │ └── TestGraph.ps1 ├── global.json ├── init.ps1 ├── scripts ├── Build.ps1 ├── DebugTest.ps1 ├── DisableStrongName.ps1 ├── DownloadNupkg.ps1 ├── FindVS.psm1 ├── GenerateFileCatalog.ps1 ├── GenerateHelp.ps1 ├── GetNetstandardAssembly.ps1 ├── InstallDotnet.ps1 ├── LaunchVS.ps1 ├── PrepManualTesting.ps1 ├── PublishModules.ps1 ├── ResetNupkg.ps1 ├── RestorePackages.ps1 ├── Test.ps1 ├── UpdateModuleDependencies.ps1 └── UpdatePSModuleManifest.ps1 ├── src ├── Common │ ├── Commands.Common.Test │ │ ├── CmdletExtensions.cs │ │ ├── Commands.Common.Test.csproj │ │ ├── FakeHttpClientHandler.cs │ │ ├── PowerBILoggerTests.cs │ │ ├── PowerBISettingsTests.cs │ │ ├── TestAuthenticator.cs │ │ ├── TestClient.cs │ │ ├── TestLogger.cs │ │ ├── TestLoggerFactory.cs │ │ ├── TestPowerBICmdletInitFactory.cs │ │ ├── TestPowerBICmdletNoClientInitFactory.cs │ │ ├── TestProfile.cs │ │ └── TestUtilities.cs │ ├── Commands.Common │ │ ├── AuthenticationFactorySelector.cs │ │ ├── Commands.Common.csproj │ │ ├── GSCloudEnvironments.cs │ │ ├── ModuleDataStorage.cs │ │ ├── PowerBICmdlet.cs │ │ ├── PowerBIConfiguration.cs │ │ ├── PowerBILogger.cs │ │ ├── PowerBILoggerFactory.cs │ │ ├── PowerBISettings.cs │ │ └── settings.json │ ├── Common.Abstractions │ │ ├── Common.Abstractions.csproj │ │ ├── Interfaces │ │ │ ├── IAccessToken.cs │ │ │ ├── IAuthenticationBaseFactory.cs │ │ │ ├── IAuthenticationFactory.cs │ │ │ ├── IAuthenticationServicePrincipalFactory.cs │ │ │ ├── IAuthenticationUserFactory.cs │ │ │ ├── IDataStorage.cs │ │ │ ├── IPowerBICmdlet.cs │ │ │ ├── IPowerBICmdletInitFactory.cs │ │ │ ├── IPowerBIConfigurationSettings.cs │ │ │ ├── IPowerBIEnvironment.cs │ │ │ ├── IPowerBILogger.cs │ │ │ ├── IPowerBILoggerFactory.cs │ │ │ ├── IPowerBIProfile.cs │ │ │ ├── IPowerBISettings.cs │ │ │ ├── IUserFilter.cs │ │ │ ├── IUserFirstSkip.cs │ │ │ ├── IUserId.cs │ │ │ └── IUserScope.cs │ │ ├── PowerBICmdletInitFactory.cs │ │ ├── PowerBIEnvironment.cs │ │ ├── PowerBIEnvironmentType.cs │ │ ├── PowerBIProfile.cs │ │ ├── PowerBIProfileType.cs │ │ ├── PowerBIUserScope.cs │ │ └── Utilities │ │ │ ├── DirectoryUtility.cs │ │ │ └── HttpClientExtensions.cs │ ├── Common.Api │ │ ├── ActivityEvent │ │ │ ├── ActivityEventResponse.cs │ │ │ └── OutputType.cs │ │ ├── Admin │ │ │ ├── AdminClient.cs │ │ │ └── IAdminClient.cs │ │ ├── Capacities │ │ │ ├── Capacity.cs │ │ │ ├── CapacityClient.cs │ │ │ └── ICapacityClient.cs │ │ ├── Common.Api.csproj │ │ ├── Dataflows │ │ │ ├── Dataflow.cs │ │ │ ├── DataflowsClient.cs │ │ │ └── IDataflowsClient.cs │ │ ├── Datasets │ │ │ ├── Column.cs │ │ │ ├── Dataset.cs │ │ │ ├── DatasetStorage.cs │ │ │ ├── DatasetsClient.cs │ │ │ ├── IDatasetsClient.cs │ │ │ ├── Measure.cs │ │ │ ├── PatchDatasetRequest.cs │ │ │ ├── PowerBIDataType.cs │ │ │ ├── Relationship.cs │ │ │ ├── Row.cs │ │ │ └── Table.cs │ │ ├── Encryption │ │ │ ├── Dataset.cs │ │ │ └── EncryptionKey.cs │ │ ├── Helpers │ │ │ └── EnumTypeConverter.cs │ │ ├── IPowerBIApiClient.cs │ │ ├── PowerBIApiClient.cs │ │ ├── PowerBIEntityClient.cs │ │ ├── PowerBIFeatureNotAvailableError.cs │ │ ├── PowerBIFeatureNotAvailableErrorType.cs │ │ ├── Reports │ │ │ ├── Dashboard.cs │ │ │ ├── IReportsClient.cs │ │ │ ├── Import.cs │ │ │ ├── ImportConflictHandlerModeEnum.cs │ │ │ ├── ImportException.cs │ │ │ ├── Report.cs │ │ │ ├── ReportsClient.cs │ │ │ └── Tile.cs │ │ ├── Shared │ │ │ ├── Datasource.cs │ │ │ └── DatasourceConnectionDetails.cs │ │ ├── Workbooks │ │ │ └── Workbook.cs │ │ └── Workspaces │ │ │ ├── ArtifactType.cs │ │ │ ├── IWorkspacesClient.cs │ │ │ ├── Workspace.cs │ │ │ ├── WorkspaceRestoreRequest.cs │ │ │ ├── WorkspaceState.cs │ │ │ ├── WorkspaceType.cs │ │ │ ├── WorkspaceUser.cs │ │ │ ├── WorkspaceUserAccessRight.cs │ │ │ ├── WorkspaceUserPrincipalType.cs │ │ │ └── WorkspacesClient.cs │ ├── Common.Authentication │ │ ├── Common.Authentication.csproj │ │ ├── DeviceCodeAuthenticationFactory.cs │ │ ├── Extensions.cs │ │ ├── LoggingUtils.cs │ │ ├── PowerBIAccessToken.cs │ │ ├── PublicClientHelper.cs │ │ ├── ServicePrincipalAuthenticationFactory.cs │ │ └── WindowsAuthenticationFactory.cs │ ├── Common.Client │ │ ├── Common.Client.csproj │ │ ├── IPowerBIClientCmdletInitFactory.cs │ │ ├── IPowerBIClientFactory.cs │ │ ├── PowerBIClientCmdlet.cs │ │ ├── PowerBIClientCmdletInitFactory.cs │ │ ├── PowerBIClientFactory.cs │ │ ├── PowerBIGetCmdlet.cs │ │ └── PowerBIHttpClientHandler.cs │ └── Common.Dependencies │ │ └── Common.Dependencies.csproj └── Modules │ ├── Admin │ ├── Commands.Admin.Test │ │ ├── AddPowerBIEncryptionKeyTests.cs │ │ ├── Commands.Admin.Test.csproj │ │ ├── GetPowerBIActivityEventTests.cs │ │ ├── GetPowerBIEncryptionKeyTests.cs │ │ ├── GetPowerBIWorkspaceEncryptionStatusTests.cs │ │ ├── SetPowerBICapacityEncryptionKeyTests.cs │ │ └── SwitchPowerBIEncryptionKeyTests.cs │ └── Commands.Admin │ │ ├── AddPowerBIEncryptionKey.cs │ │ ├── Commands.Admin.csproj │ │ ├── GetPowerBIActivityEvent.cs │ │ ├── GetPowerBIEncryptionKey.cs │ │ ├── GetPowerBIWorkspaceEncryptionStatus.cs │ │ ├── Microsoft.PowerBI.Commands.Admin.format.ps1xml │ │ ├── MicrosoftPowerBIMgmt.Admin.psd1 │ │ ├── PowerBIGetEncryptionKeyClientCmdlet.cs │ │ ├── SetPowerBICapacityEncryptionKey.cs │ │ ├── SwitchPowerBIEncryptionKey.cs │ │ └── help │ │ ├── Add-PowerBIEncryptionKey.md │ │ ├── Get-PowerBIActivityEvent.md │ │ ├── Get-PowerBIEncryptionKey.md │ │ ├── Get-PowerBIWorkspaceEncryptionStatus.md │ │ ├── MicrosoftPowerBIMgmt.Admin.md │ │ ├── Set-PowerBICapacityEncryptionKey.md │ │ └── Switch-PowerBIEncryptionKey.md │ ├── All │ └── Commands.All │ │ ├── Commands.All.csproj │ │ └── MicrosoftPowerBIMgmt.psd1 │ ├── Capacities │ ├── Commands.Capacities.Test │ │ ├── Commands.Capacities.Test.csproj │ │ └── GetPowerBICapacityTests.cs │ └── Commands.Capacities │ │ ├── Commands.Capacities.csproj │ │ ├── GetPowerBICapacity.cs │ │ ├── Microsoft.PowerBI.Commands.Capacities.format.ps1xml │ │ ├── MicrosoftPowerBIMgmt.Capacities.psd1 │ │ └── help │ │ ├── Get-PowerBICapacity.md │ │ └── MicrosoftPowerBIMgmt.Capacities.md │ ├── Data │ ├── Commands.Data.Test │ │ ├── AddPowerBIDatasetTests.cs │ │ ├── AddPowerBIRowTests.cs │ │ ├── Commands.Data.Test.csproj │ │ ├── ExportPowerBIDataflowTests.cs │ │ ├── GetPowerBIDataflowDatasourceTests.cs │ │ ├── GetPowerBIDataflowTests.cs │ │ ├── GetPowerBIDatasetTests.cs │ │ ├── GetPowerBIDatasourceTests.cs │ │ ├── GetPowerBITableTests.cs │ │ ├── RemovePowerBIRowTests.cs │ │ ├── SetPowerBIDatasetTests.cs │ │ ├── SetPowerBITableTests.cs │ │ └── dataflowModel.json │ └── Commands.Data │ │ ├── AddPowerBIDataset.cs │ │ ├── AddPowerBIRow.cs │ │ ├── Commands.Data.csproj │ │ ├── ExportPowerBIDataflow.cs │ │ ├── GetPowerBIDataflow.cs │ │ ├── GetPowerBIDataflowDatasource.cs │ │ ├── GetPowerBIDataset.cs │ │ ├── GetPowerBIDatasource.cs │ │ ├── GetPowerBITable.cs │ │ ├── Microsoft.PowerBI.Commands.Data.format.ps1xml │ │ ├── MicrosoftPowerBIMgmt.Data.psd1 │ │ ├── NewPowerBIColumn.cs │ │ ├── NewPowerBIDataset.cs │ │ ├── NewPowerBITable.cs │ │ ├── RemovePowerBIRow.cs │ │ ├── SetPowerBIDataset.cs │ │ ├── SetPowerBITable.cs │ │ └── help │ │ ├── Add-PowerBIDataset.md │ │ ├── Add-PowerBIRow.md │ │ ├── Export-PowerBIDataflow.md │ │ ├── Get-PowerBIDataflow.md │ │ ├── Get-PowerBIDataflowDatasource.md │ │ ├── Get-PowerBIDataset.md │ │ ├── Get-PowerBIDatasource.md │ │ ├── Get-PowerBITable.md │ │ ├── MicrosoftPowerBIMgmt.Data.md │ │ ├── New-PowerBIColumn.md │ │ ├── New-PowerBIDataset.md │ │ ├── New-PowerBITable.md │ │ ├── Remove-PowerBIRow.md │ │ ├── Set-PowerBIDataset.md │ │ └── Set-PowerBITable.md │ ├── Profile │ ├── Commands.Profile.Test │ │ ├── Commands.Profile.Test.csproj │ │ ├── ConnectPowerBIServiceAccountTests.cs │ │ ├── DisconnectPowerBIServiceAccountTests.cs │ │ ├── InvokePowerBIRestMethodTests.cs │ │ └── ProfileTestUtilities.cs │ └── Commands.Profile │ │ ├── Commands.Profile.csproj │ │ ├── ConnectPowerBIServiceAccount.cs │ │ ├── DisconnectPowerBIServiceAccount.cs │ │ ├── Errors │ │ ├── PowerBIErrorRecord.cs │ │ ├── PowerBIExceptionRecord.cs │ │ └── PowerBIRestExceptionRecord.cs │ │ ├── GetPowerBIAccessToken.cs │ │ ├── InvokePowerBIRestMethod.cs │ │ ├── Microsoft.PowerBI.Commands.Profile.format.ps1xml │ │ ├── Microsoft.PowerBI.Commands.Profile.types.ps1xml │ │ ├── MicrosoftPowerBIMgmt.Profile.psd1 │ │ ├── PowerBIWebRequestMethod.cs │ │ ├── ResolvePowerBIError.cs │ │ └── help │ │ ├── Connect-PowerBIServiceAccount.md │ │ ├── Disconnect-PowerBIServiceAccount.md │ │ ├── Get-PowerBIAccessToken.md │ │ ├── Invoke-PowerBIRestMethod.md │ │ ├── MicrosoftPowerBIMgmt.Profile.md │ │ └── Resolve-PowerBIError.md │ ├── Reports │ ├── Commands.Reports.Test │ │ ├── Commands.Reports.Test.csproj │ │ ├── CopyPowerBIReportTests.cs │ │ ├── CopyPowerBITileTests.cs │ │ ├── GetPowerBIReportTests.cs │ │ ├── NewPowerBIDashboardTests.cs │ │ ├── NewPowerBIReportTests.cs │ │ ├── RemovePowerBIReportTests.cs │ │ └── testreport.pbix │ └── Commands.Reports │ │ ├── Commands.Reports.csproj │ │ ├── CopyPowerBIReport.cs │ │ ├── CopyPowerBITile.cs │ │ ├── ExportPowerBIReport.cs │ │ ├── GetPowerBIDashboard.cs │ │ ├── GetPowerBIImport.cs │ │ ├── GetPowerBIReport.cs │ │ ├── GetPowerBITile.cs │ │ ├── MicrosoftPowerBIMgmt.Reports.psd1 │ │ ├── NewPowerBIDashboard.cs │ │ ├── NewPowerBIReport.cs │ │ ├── RemovePowerBIReport.cs │ │ └── help │ │ ├── Copy-PowerBIReport.md │ │ ├── Copy-PowerBITile.md │ │ ├── Export-PowerBIReport.md │ │ ├── Get-PowerBIDashboard.md │ │ ├── Get-PowerBIImport.md │ │ ├── Get-PowerBIReport.md │ │ ├── Get-PowerBITile.md │ │ ├── MicrosoftPowerBIMgmt.Reports.md │ │ ├── New-PowerBIDashboard.md │ │ ├── New-PowerBIReport.md │ │ └── Remove-PowerBIReport.md │ └── Workspaces │ ├── Commands.Workspaces.Test │ ├── AddPowerBIWorkspaceUserTests.cs │ ├── Commands.Workspaces.Test.csproj │ ├── GetPowerBIWorkspaceMigrationStatusTests.cs │ ├── GetPowerBIWorkspaceTests.cs │ ├── NewPowerBIWorkspaceTests.cs │ ├── RemovePowerBIWorkspaceUserTests.cs │ ├── RestorePowerBIWorkspaceTests.cs │ ├── SetPowerBIWorkspaceTests.cs │ └── WorkspacesTestUtilities.cs │ └── Commands.Workspaces │ ├── AddPowerBIWorkspaceUser.cs │ ├── Commands.Workspaces.csproj │ ├── GetPowerBIWorkspace.cs │ ├── GetPowerBIWorkspaceMigrationStatus.cs │ ├── Microsoft.PowerBI.Commands.Workspaces.format.ps1xml │ ├── MicrosoftPowerBIMgmt.Workspaces.psd1 │ ├── NewPowerBIWorkspace.cs │ ├── RemovePowerBIWorkspaceUser.cs │ ├── RestorePowerBIWorkspace.cs │ ├── SetPowerBIWorkspace.cs │ └── help │ ├── Add-PowerBIWorkspaceUser.md │ ├── Get-PowerBIWorkspace.md │ ├── Get-PowerBIWorkspaceMigrationStatus.md │ ├── MicrosoftPowerBIMgmt.Workspaces.md │ ├── New-PowerBIWorkspace.md │ ├── Remove-PowerBIWorkspaceUser.md │ ├── Restore-PowerBIWorkspace.md │ └── Set-PowerBIWorkspace.md └── version.json /.config/dotnet-tools.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": 1, 3 | "isRoot": true, 4 | "tools": { 5 | "nbgv": { 6 | "version": "3.6.143", 7 | "commands": [ 8 | "nbgv" 9 | ], 10 | "rollForward": false 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "powerbi-powershell in Codespaces", 3 | "image": "mcr.microsoft.com/dotnet/sdk:8.0", 4 | "features": { 5 | "ghcr.io/devcontainers/features/docker-in-docker:2": {}, 6 | "ghcr.io/devcontainers/features/github-cli:1": { 7 | "version": "2" 8 | }, 9 | "ghcr.io/devcontainers/features/powershell:1": { 10 | "version": "latest" 11 | }, 12 | "ghcr.io/devcontainers/features/common-utils:2": {}, 13 | "ghcr.io/devcontainers/features/dotnet:2": { 14 | "version": "none", 15 | "dotnetRuntimeVersions": "7.0", 16 | "aspNetCoreRuntimeVersions": "7.0" 17 | } 18 | }, 19 | "customizations": { 20 | "vscode": { 21 | "extensions": [ 22 | "GitHub.copilot", 23 | "GitHub.copilot-chat", 24 | "GitHub.vscode-github-actions", 25 | "ms-dotnettools.vscode-dotnet-runtime", 26 | "ms-dotnettools.csdevkit", 27 | "ms-dotnetools.csharp", 28 | "ms-vscode.powershell", 29 | "ms-dotnettools.vscodeintellicode-csharp", 30 | "esbenp.prettier-vscode", 31 | "github.github-vscode-theme", 32 | "github.vscode-pull-request-github", 33 | "github.vscode-codeql", 34 | "ms-cst-e.vscode-devskim" 35 | ] 36 | } 37 | }, 38 | "postCreateCommand": "dotnet restore dirs.proj", 39 | "hostRequirements": { 40 | "memory": "8gb", 41 | "cpus": 4 42 | }, 43 | "remoteEnv": { 44 | "DOTNET_MULTILEVEL_LOOKUP": "0", 45 | "TARGET": "net8.0" 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | [*] 2 | end_of_line = crlf 3 | 4 | [*.xml] 5 | indent_style = space 6 | 7 | [*.cs] 8 | indent_style = space 9 | insert_final_newline = false 10 | csharp_style_conditional_delegate_call = true:suggestion 11 | csharp_style_expression_bodied_accessors = true:suggestion 12 | csharp_style_expression_bodied_constructors = true:suggestion 13 | csharp_style_expression_bodied_operators = true:suggestion 14 | csharp_style_inlined_variable_declaration = true:suggestion 15 | csharp_style_var_when_type_is_apparent = true:warning 16 | csharp_new_line_before_catch = true 17 | csharp_new_line_before_else = true 18 | csharp_new_line_before_finally = true 19 | csharp_indent_case_contents = true 20 | csharp_prefer_braces = true 21 | csharp_prefer_simple_default_expression = true 22 | dotnet_sort_system_directives_first = true 23 | dotnet_style_collection_initializer = true:suggestion 24 | dotnet_style_predefined_type_for_locals_parameters_members = true:warning 25 | dotnet_style_explicit_tuple_names = true:suggestion 26 | dotnet_style_null_propagation = true:suggestion 27 | dotnet_style_predefined_type_for_member_access = true:suggestion 28 | dotnet_style_qualification_for_event = true:suggestion 29 | dotnet_style_qualification_for_field = true:suggestion 30 | dotnet_style_qualification_for_method = true:suggestion 31 | dotnet_style_qualification_for_property = true:suggestion -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Set default behaviour, in case users don't have core.autocrlf set. 2 | * text=auto 3 | 4 | *.sln text eol=crlf 5 | *.cs text eol=crlf 6 | *.csproj text eol=crlf 7 | *.ps1 text eol=crlf 8 | *.psd1 text eol=crlf 9 | *.psm1 text eol=crlf 10 | *.ps1xml text eol=crlf 11 | build.proj text eol=crlf -------------------------------------------------------------------------------- /.github/workflows/package.yml: -------------------------------------------------------------------------------- 1 | name: Upload Package to GitHub Packages 2 | 3 | on: 4 | release: 5 | types: [created] 6 | 7 | jobs: 8 | deploy: 9 | runs-on: [self-hosted, 1ES.Pool=powerbi-powershell-pool] 10 | permissions: 11 | packages: write 12 | contents: read 13 | steps: 14 | - uses: actions/checkout@v4 15 | with: 16 | fetch-depth: 0 # Need for history to be able to determine version number 17 | 18 | - uses: actions/setup-dotnet@v3 19 | with: 20 | #dotnet-version: '8.0.x' # SDK Version to use. 21 | global-json-file: 'global.json' 22 | source-url: https://nuget.pkg.github.com/microsoft/powerbi-powershell/index.json 23 | env: 24 | NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} 25 | 26 | - name: Create the package 27 | run: dotnet pack --configuration Release dirs.proj 28 | 29 | - name: Publish the package to GPR 30 | run: dotnet nuget push PkgOut/*.nupkg -------------------------------------------------------------------------------- /.github/workflows/pr.yml: -------------------------------------------------------------------------------- 1 | # https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net 2 | 3 | name: PR Build 4 | run-name: Executing Build for ${{ github.actor }} on ${{ github.repository }} for branch ${{ github.ref }} 5 | 6 | on: 7 | pull_request: 8 | types: 9 | - opened 10 | - synchronize 11 | - reopened 12 | branches: 13 | - master 14 | 15 | jobs: 16 | Build: 17 | runs-on: [self-hosted, 1ES.Pool=powerbi-powershell-pool] 18 | steps: 19 | - name: Check out repository code 20 | uses: actions/checkout@v4 21 | with: 22 | fetch-depth: 0 # Need for history to be able to determine version number 23 | 24 | - name: Disable StrongName 25 | shell: pwsh 26 | run: | 27 | scripts/DisableStrongName.ps1 28 | 29 | - name: Setup .NET 8.x 30 | uses: actions/setup-dotnet@v3 31 | with: 32 | # Semantic version range syntax or exact version of a dotnet version 33 | #dotnet-version: '8.x' 34 | global-json-file: 'global.json' 35 | 36 | - uses: actions/cache@v3 37 | with: 38 | path: ~/.nuget/packages 39 | # Look to see if there is a cache hit for the corresponding requirements file 40 | key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.*proj','**/*.props','**/*.targets','**/*.cs') }} 41 | restore-keys: | 42 | ${{ runner.os }}-nuget 43 | 44 | - name: Restore dependencies 45 | run: dotnet restore dirs.proj 46 | 47 | - name: Build 48 | run: dotnet build --no-restore dirs.proj --property:GenerateFullPaths=true --verbosity normal 49 | 50 | - name: Test 51 | run: dotnet test --no-build --no-restore --filter "TestCategory!=Interactive" --verbosity normal --logger trx --results-directory "TestResults" dirs.proj 52 | 53 | - name: Publish Test Results 54 | uses: actions/upload-artifact@v4 55 | with: 56 | name: TestResults 57 | path: TestResults 58 | if: ${{ always() }} 59 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [ 3 | "ms-vscode.powershell", 4 | "ms-dotnettools.csdevkit", 5 | "ms-dotnettools.vscodeintellicode-csharp", 6 | "GitHub.copilot", 7 | "GitHub.copilot-chat", 8 | "MS-CST-E.vscode-devskim", 9 | "ms-sarifvscode.sarif-viewer", 10 | "esbenp.prettier-vscode", 11 | "github.codespaces", 12 | "github.github-vscode-theme", 13 | "github.vscode-pull-request-github", 14 | "github.vscode-github-actions", 15 | "github.vscode-codeql" 16 | ] 17 | } -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to find out which attributes exist for C# debugging 3 | // Use hover for the description of the existing attributes 4 | // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md 5 | "version": "0.2.0", 6 | "configurations": [ 7 | // { 8 | // "name": ".NET Core Launch (console)", 9 | // "type": "coreclr", 10 | // "request": "launch", 11 | // "preLaunchTask": "Build", 12 | // // If you have changed target frameworks, make sure to update the program path. 13 | // "program": "${workspaceFolder}/src/Common/Commands.Common.Test/bin/Debug/netcoreapp2.0/Microsoft.PowerBI.Commands.Common.Test.dll", 14 | // "args": [], 15 | // "cwd": "${workspaceFolder}/src/Common/Commands.Common.Test", 16 | // // For more information about the 'console' field, see https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md#console-terminal-window 17 | // "console": "internalConsole", 18 | // "stopAtEntry": false, 19 | // "internalConsoleOptions": "openOnSessionStart" 20 | // }, 21 | { 22 | "name": ".NET Core Attach", 23 | "type": "coreclr", 24 | "request": "attach", 25 | "processId": "${command:pickProcess}" 26 | }, 27 | { 28 | "type": "PowerShell", 29 | "request": "attach", 30 | "name": "PowerShell Attach to Host Process", 31 | "processId": "${command:PickPSHostProcess}", 32 | "runspaceId": 1 33 | }, 34 | { 35 | "type": "PowerShell", 36 | "request": "launch", 37 | "name": "PowerShell Interactive Session", 38 | "cwd": "${workspaceRoot}" 39 | } 40 | ,] 41 | } -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "files.exclude": { 3 | "**/packages/": true, 4 | "**/.vs/": true, 5 | "**/bin/": true, 6 | "**/obj/": true, 7 | "TestResult/": true, 8 | ".mono/": true, 9 | "powerbi-powershell.sln": true 10 | } 11 | } -------------------------------------------------------------------------------- /Directory.Build.rsp: -------------------------------------------------------------------------------- 1 | -restore 2 | -consoleLoggerParameters:Verbosity=Minimal;Summary;ForceNoAlign 3 | -maxCpuCount 4 | -IgnoreProjectExtensions:.sln -------------------------------------------------------------------------------- /Directory.Build.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 9 | 10 | 11 | 12 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /Directory.Packages.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | true 7 | true 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) Microsoft Corporation. All rights reserved. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE 22 | -------------------------------------------------------------------------------- /NuGet.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /ReleaseNotes.md: -------------------------------------------------------------------------------- 1 | Update Microsoft.Identity.Client version to 4.27.0 -------------------------------------------------------------------------------- /build/35MSSharedLib1024.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/powerbi-powershell/e74e960edc14066e5db7df07c5a59054cbcefaa4/build/35MSSharedLib1024.snk -------------------------------------------------------------------------------- /build/Microsoft.PowerBI.CodeSign.targets: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 12 | false 13 | false 14 | 15 | 16 | 17 | 18 | true 19 | true 20 | $(MSBuildThisFileDirectory)35MSSharedLib1024.snk 21 | 22 | 23 | 24 | 25 | false 26 | false 27 | 28 | 29 | -------------------------------------------------------------------------------- /dirs.proj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | true 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /global.json: -------------------------------------------------------------------------------- 1 | { 2 | "sdk": { 3 | "version": "8.0.402", 4 | "rollForward": "latestFeature" 5 | }, 6 | "msbuild-sdks": { 7 | "Microsoft.Build.Traversal": "4.1.0", 8 | "Microsoft.Build.NoTargets": "3.7.56", 9 | "Microsoft.Build.Artifacts": "6.1.10" 10 | } 11 | } -------------------------------------------------------------------------------- /init.ps1: -------------------------------------------------------------------------------- 1 | $scriptsDir = (Get-Item "$PSScriptRoot\scripts").FullName 2 | 3 | if($env:Path -split ';' -inotcontains $scriptsDir) { 4 | Write-Verbose "Adding '$scriptsDir' to Path environment variable..." 5 | $env:Path = $env:Path.TrimEnd(';') 6 | $env:Path += ";$scriptsDir" 7 | } 8 | 9 | $scripts = Get-ChildItem -Path $scriptsDir -Filter *.ps1 10 | foreach ($script in $scripts) { 11 | $scriptName = $script.BaseName 12 | Set-Alias -Name $scriptName -Value $script.FullName -Scope Global -Option AllScope -ErrorAction SilentlyContinue 13 | } 14 | 15 | Write-Host "Any script (*.ps1) in $scriptsDir can be called with just name of script, example 'build'" -ForegroundColor Gray 16 | Write-Host "Welcome to powerbi-powershell repository!`n" -ForegroundColor Green -------------------------------------------------------------------------------- /scripts/FindVS.psm1: -------------------------------------------------------------------------------- 1 | function Get-VSBuildFolder 2 | { 3 | [OutputType([string])] 4 | param 5 | ( 6 | [switch] $Prerelease 7 | ) 8 | 9 | if ($IsLinux -or $IsMacOS) { 10 | throw "This script is not supported on Linux or macOS. Use dotnet CLI instead." 11 | } 12 | 13 | # https://github.com/Microsoft/vswhere 14 | $vsWhereExe = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" 15 | if(!(Test-Path -Path $vsWhereExe)) { 16 | throw "Unable to find vswhere, confirm Visual Studio is installed: $vsWhereExe" 17 | } 18 | 19 | $vsWhereArgs = @('-latest', '-requires', 'Microsoft.Component.MSBuild', '-find', 'MSBuild\**\Bin\MSBuild.exe') 20 | if($Prerelease) { 21 | $vsWhereArgs += '-prerelease' 22 | } 23 | 24 | # https://github.com/microsoft/vswhere/wiki/Find-MSBuild#powershell 25 | $msbuildPath = & $vsWhereExe $vsWhereArgs | select-object -first 1 26 | if ((!$msbuildPath) -or ($LASTEXITCODE -ne 0)) { 27 | throw "Unable to find MSBuild using vswhere" 28 | } 29 | 30 | if(!(Test-Path -Path $msbuildPath)) { 31 | throw "Unable to find MSBuild: $msbuildPath" 32 | } 33 | 34 | return $msbuildPath 35 | } -------------------------------------------------------------------------------- /scripts/InstallDotnet.ps1: -------------------------------------------------------------------------------- 1 | $tempDir = [IO.Path]::GetTempPath() 2 | if ($IsWindows) { 3 | $scriptPath = Join-Path -Path $tempDir -ChildPath 'dotnet-install.ps1' 4 | if (Test-Path -Path $scriptPath) { 5 | Remove-Item -Path $scriptPath -Force 6 | } 7 | 8 | Write-Host 'Downloading https://dot.net/v1/dotnet-install.ps1' 9 | Invoke-WebRequest -Uri 'https://dot.net/v1/dotnet-install.ps1' -OutFile $scriptPath 10 | Unblock-File $scriptPath 11 | } 12 | elseif ($IsLinux -or $IsMacOS) { 13 | # Bash scripts work on both OS and are stored in the Linux directory 14 | # wget -q "https://dot.net/v1/dotnet-install.sh" 15 | $scriptPath = Join-Path -Path $tempDir -ChildPath 'dotnet-install.sh' 16 | if (Test-Path -Path $scriptPath) { 17 | Remove-Item -Path $scriptPath -Force 18 | } 19 | 20 | Write-Host 'Downloading https://dot.net/v1/dotnet-install.sh' 21 | Invoke-WebRequest -Uri 'https://dot.net/v1/dotnet-install.sh' -OutFile $scriptPath 22 | chmod +x $scriptPath 23 | } 24 | 25 | $globalJsonPath = (Resolve-Path "$PSScriptRoot/../global.json" -ErrorAction Stop).ProviderPath 26 | 27 | # For arguments to dotnet script see: 28 | # https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-install-script 29 | 30 | if ($IsWindows) { 31 | Write-Host "Executing: $scriptPath -JSonFile $globalJsonPath" 32 | & $scriptPath -JSonFile $globalJsonPath 33 | } 34 | elseif ($IsLinux -or $IsMacOS) { 35 | Write-Host "Executing: $scriptPath --jsonfile `"$globalJsonPath`"" 36 | & $scriptPath --jsonfile "$globalJsonPath" 37 | } 38 | else { 39 | Write-Error "Unsupported OS platform" -ErrorAction Continue 40 | exit 1 41 | } -------------------------------------------------------------------------------- /scripts/LaunchVS.ps1: -------------------------------------------------------------------------------- 1 | [CmdletBinding()] 2 | param 3 | ( 4 | # Path to solution file. Defaults to