Forum Discussion
Automating Updating a Dataset's Datasource and the Gateway Datasource "Maps To" with PowerShell
Hi,
I am using org service account that's synced to Azure AD. When I manually login (Login-PowerBIServiceAccount) it works - I get pop up to login where I would enter service account anme and password into my org login page. Then it connects and I can bind the gateway. However when I try to use below code for automation, it doesn't work.
$PbiSecurePassword = ConvertTo-SecureString $password -Force -AsPlainText
$PbiCredential = New-Object Management.Automation.PSCredential($username, $PbiSecurePassword)
Connect-PowerBIServiceAccount -Credential $PbiCredential
Login-PowerBIServiceAccount -Credential $PbiCredential
Any Ideas: I am thinking that it's because I am not using @onmicrosoft.com account and for some reason PowerBi commandlet doesn't support connect / login doesn't support accounts that are synced via Azure Sync??
Any advise is appreciated.
Thanks