Forum Discussion
Connect by Powershell
Hi Anonymous ,
Have you installed "MicrosoftPowerBIMgmt" module?
Install-Module -Name MicrosoftPowerBIMgmt
And 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,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Anonymous5 years agoNot 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-msft5 years agoCommunity 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.
- Anonymous5 years agoNot applicable
Disabling MFA on my account isn't an option. I have tried to connect using a service principal, but it still doesn't work:
My script:
#Import Import-Module MicrosoftPowerBIMgmt Import-Module MicrosoftPowerBIMgmt.Profile #Variables $AppId = "XXXX" $TenantId = "XXXX" $ClientSecret = "XXXX" #Create secure string & credential for application id and client secret $PbiSecurePassword = ConvertTo-SecureString $ClientSecret -Force -AsPlainText $PbiCredential = New-Object Management.Automation.PSCredential($AppId, $PbiSecurePassword) #Connect to the Power BI service Connect-PowerBIServiceAccount -ServicePrincipal -TenantId $TenantId -Credential $PbiCredential Disconnect-PowerBIServiceAccountError message:
Connect-PowerBIServiceAccount : One or more errors occurred. At C:\Temp\Scripts\Script.ps1:26 char:1 + Connect-PowerBIServiceAccount -ServicePrincipal -TenantId $TenantId - ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : WriteError: (Microsoft.Power...IServiceAccount:ConnectPowerBIServiceAccount) [Connect-PowerBIServiceAccount], AggregateException + FullyQualifiedErrorId : One or more errors occurred.,Microsoft.PowerBI.Commands.Profile.ConnectPowerBIServiceAccount