cancel
Showing results for 
Search instead for 
Did you mean: 

Connect-PowerBIServiceAccount without prompting to pick an account

I am trying to connect PowerBI by passing crediting to automate the PowerShell script for extraction PBIX templates across the workspaces at organization level. This below script is not working.

Script:

Import-Module MicrosoftPowerBIMgmt
Import-Module MicrosoftPowerBIMgmt.Profile

$password = "mypassword" | ConvertTo-SecureString -asPlainText -Force
$username = "myemail"
$credential = New-Object System.Management.Automation.PSCredential($username, $password)

Connect-PowerBIServiceAccount -Credential $credential

 

Errors:

Connect-PowerBIServiceAccount : Failed to get ADAL token: Unhandled Exception: System.AggregateException: One or more
errors occurred. ---> Microsoft.IdentityModel.Clients.ActiveDirectory.AdalServiceException:
accessing_ws_metadata_exchange_failed: Accessing WS metadata exchange failed --->
System.Net.Http.HttpRequestException: Response status code does not indicate success: 406 (NotAcceptable). --->
Microsoft.IdentityModel.Clients.ActiveDirectory.AdalException: : Unknown error --- End of inner exception stack
trace --- --- End of inner exception stack trace --- at

Status: New
Comments
Community Support