Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support -Tenant parameter on Connect-PowerBIServiceAccount when using the UserParameterSet and UserAndCredentialPasswordParameterSet #244

Open
joem-msft opened this issue Aug 6, 2020 · 4 comments · May be fixed by #257

Comments

@joem-msft
Copy link

I'm creating some PBI data-tenants that are managed by B2B admins. We'd like these admins to be able to run the PBI PowerShell commands but the Connect-PowerBIServiceAccount doesn't allow specifying the -Tenant parameter for the 'User' parameter set.

This prevents B2B guest admins from being able to administer the PBI tenant, like create workspaces, etc.

Command:

Connect-PowerBIServiceAccount -TenantId 'ad347600-0000-0000-0000-000000000000'

Give the following error:

Connect-PowerBIServiceAccount : Parameter set cannot be resolved using the specified named parameters.
At line:1 char:1
+ Connect-PowerBIServiceAccount -TenantId 'ad347600-0000-0000-0000-0000 ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Connect-PowerBIServiceAccount], ParameterBindingException
    + FullyQualifiedErrorId : AmbiguousParameterSet,Microsoft.PowerBI.Commands.Profile.ConnectPowerBIServiceAccount

I'm running version 1.0.840 of the MicrosoftPowerBIMgmt module.

The original PR that added the -Tenant parameter was: https://github.com/microsoft/powerbi-powershell/pull/42/files

@matt40k
Copy link

matt40k commented Sep 10, 2020

Couldn't you use Connect-AzAccount?

@joem-msft joem-msft changed the title Support -Tenant parameter on Connect-PowerBIServiceAccount when using the UserParameterSet Support -Tenant parameter on Connect-PowerBIServiceAccount when using the UserParameterSet and UserAndCredentialPasswordParameterSet Oct 7, 2020
@joem-msft
Copy link
Author

The fix for this issue looks like simply adding the following attribute(s) to ConnectPowerBIServiceAccount.cs on the property Credential:

[Parameter(ParameterSetName = UserAndCredentialPasswordParameterSet, Mandatory = false)]
[Parameter(ParameterSetName = UserParameterSet, Mandatory = false)]

This would allow the PS command parameter set parsing to stop giving the error reported above, as the code already had the implementation needed to apply the TenantId parameter to the environment.

@matt40k, The Power BI module commands don't have access to the authentication token in the Az modules. Furthermore, the resource endpoints being accessed from the Az modules are a different AD resource than the Power BI apis, so the token used for Azure management endpoints won't work with Power BI endpoints anyways.

@joem-msft
Copy link
Author

Added a PR. Looks like removing the specific parameter set names is a cleaner solution.

@jonaskoeASYS
Copy link

Any changes on this issue planned? As far as I can see there is still no guest user support or is it possible to use CustomEnvironment for that (if yes, are there any examples)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants