cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
oroberto Frequent Visitor
Frequent Visitor

ADAL token problem when connecting to PowerBI Service via API from powershell

hi, 

 

I'm trying to connect to powerBI by using API from powershell.

 

this is the code that I'm using:

$common = $PSScriptRoot + "\common.ps1"
. $common

##set parent directory for this file
#set project setting file
$parentfDir = Split-Path $PSScriptRoot -Parent 
$confDir = getFilePath $parentfDir "\json\automation_tools_seting.json"

#get project settings and package parameter
$conf = loadJsonFile $confDir

$user = $conf.PBI_user
$pass = $conf.PBI_pass | ConvertTo-SecureString -asPlainText -Force

$credential = New-Object System.Management.Automation.PSCredential ($user, $pass)
try {
    Connect-PowerBIServiceAccount -Credential $credential

    Disconnect-PowerBIServiceAccount
}
catch {
   Write-Output "$($_.Exception.Message)"
    
}

but it always has an error :

Connect-PowerBIServiceAccount : Failed to get ADAL token:

 

wondering if there's any mistake inside my code

Helpful resources

Announcements
Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Power BI Helps Homeless and Trouble Youth

Power BI Helps Homeless and Trouble Youth

We spoke with Power BI Super User, Greg Deckler, about his charity work

MBAS Gallery

Watch Sessions On Demand!

Continue your learning in our online communities.

Users Online
Currently online: 317 members 3,487 guests
Please welcome our newest community members: