Forum Discussion
Connect by Powershell
My Powershell script to connect to the Service is failing at the first hurdle:
This is how I'm trying to connect:
Import-Module MicrosoftPowerBIMgmt
Connect-PowerBIServiceAccount -Tenant xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx -ServicePrincipal -Credential (Get-Credential)This seems to match Example 3 from MIcrosoft's guidance:
But I get the following error message:
Connect-PowerBIServiceAccount : One or more errors occurred.
At C:\Temp\Scripts\PBIScript.ps1:9 char:1
+ Connect-PowerBIServiceAccount -Tenant xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxx ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : WriteError: (Microsoft.Power...IServiceAccount:ConnectPowerBIServiceAccount) [Connect-PowerBIServiceAccount], AggregateException
+ FullyQualifiedErrorId : One or more errors occurred.,Microsoft.PowerBI.Commands.Profile.ConnectPowerBIServiceAccount
The account I'm trying to use to connect is covered by our MFA policy - so I am expecting to get an MFA prompt.
The script doesn't need to be automated, I'[m happy to receive a manual prompt for username, password and MFA.
7 Replies
- v-kkf-msftCommunity Support
Hi Anonymous ,
Have you installed "MicrosoftPowerBIMgmt" module?
Install-Module -Name MicrosoftPowerBIMgmtAnd you can also see if these posts are helpful.
https://community.powerbi.com/t5/Service/PowerShell-Login-to-Power-BI-Write-Error/m-p/1094922
Can't connect to PowerBI service account
If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
WinnizIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- AnonymousNot applicable
Yes, I have installed the "MicrosoftPowerBIMgmt" module.
A present my script looks like this:
Import-Module MicrosoftPowerBIMgmt Import-Module MicrosoftPowerBIMgmt.Profile Connect-PowerBIServiceAccountBut I get the error below:
Connect-PowerBIServiceAccount : One or more errors occurred.
At C:\Temp\Scripts\PBIScript.ps1:15 char:1
+ Connect-PowerBIServiceAccount
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : WriteError: (Microsoft.Power...IServiceAccount:ConnectPowerBIServiceAccount) [Connect-PowerBIServiceAccount], Aggregat
eException
+ FullyQualifiedErrorId : One or more errors occurred.,Microsoft.PowerBI.Commands.Profile.ConnectPowerBIServiceAccount- v-kkf-msftCommunity Support
Hi Anonymous ,
This error will be thrown when the login fails. I tested and found that I could not connect using a MFA account. You need to disable the MFA for your account. Or you can use service principal and an application secret, like this
If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
WinnizIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.