Forum Discussion
Connecting PowerBI from Power Shell without prompting
I created a certificate thumbprint and passed with other parameters. But I encountered the below error. Is there any specific order for passing the parameters.
Command:
Connect-PowerBIServiceAccount -ServicePrincipal -CertificateThumbprint xxxxxxxxxxx -ApplicationId xxxxxxxxxxx -Credential $credential -TenantId xxxxxxxxxxxxxx
=====================================================
Error:
Connect-PowerBIServiceAccount : Parameter set cannot be resolved using the specified named parameters.
At line:1 char:1
+ Connect-PowerBIServiceAccount -ServicePrincipal -CertificateThumbprin ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Connect-PowerBIServiceAccount], ParameterBindingException
+ FullyQualifiedErrorId : AmbiguousParameterSet,Microsoft.PowerBI.Commands.Profile.ConnectPowerBIServiceAccount
You don't need the -Credential part. That's only if you're using the Application Secret approach. For me I had the following: Connect-PowerBIServiceAccount -ServicePrincipal -CertificateThumbprint XXXXXXXXX -ApplicationId XXXXXX -Tenant XXXXXXXX
- kranthi_sunkara4 years agoRegular Visitor
No luck for me 😞 Getting error again. Not sure if it needs any permissions.
Connect-PowerBIServiceAccount -ServicePrincipal -CertificateThumbprint xxxx -ApplicationId xxxxxx -Tenant xxxxxxxxxx
Connect-PowerBIServiceAccount : One or more errors occurred.
At line:1 char:1
+ Connect-PowerBIServiceAccount -ServicePrincipal -CertificateThumbprin ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : WriteError: (Microsoft.Power...IServiceAccount:ConnectPowerBIServiceAccount) [Connect-Po
werBIServiceAccount], AggregateException
+ FullyQualifiedErrorId : One or more errors occurred.,Microsoft.PowerBI.Commands.Profile.ConnectPowerBIServiceAcc
ount- Anonymous4 years agoNot applicable
If you haven't already, you'll need need to install that certificate at either the user level or machine level on the machine that's running that powershell script. My AD guy created a PFX export of the certificate and that was installed on the server that's running my script. I can't speak to how the export was created (that's certainly not my domain) but maybe you do.
- kranthi_sunkara4 years agoRegular Visitor
I was able to login successfully without popup using the below command. For credentials, I used appid and secret as username and password.
Connect-PowerBIServiceAccount -ServicePrincipal -Credential $Creds -Tenant $TenantIdBut now, I am having issues retrieving the workspace I need. I am trying to retrive my workspace using workspace id. But I am getting unauthorized error. Does the user I am using should be admin?
Get-PowerBIWorkspace -Id xxxxxxxxxxError:
Get-PowerBIWorkspace : Operation returned an invalid status code 'Unauthorized'
At line:1 char:1
+ Get-PowerBIWorkspace -Id xxxxxxxxxxxxx
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : WriteError: (Microsoft.Power...owerBIWorkspace:GetPowerBIWorkspace) [Get-PowerBIWorkspace], HttpOperationException
+ FullyQualifiedErrorId : Operation returned an invalid status code 'Unauthorized',Microsoft.PowerBI.Commands.Workspaces.GetPowerBIWorkspace