Showing results for 
Search instead for 
Did you mean: 

Error refreshing Power BI dataset using Service Principal and PowerShell

I am trying to refresh a Power BI dataset using a Service Principal and PowerShell. I have followed all the requirements and steps outlined in the following documentation:


1. Created a service principal

2. Enabled service principals access to Power BI tenant

3. Added the service principal into my workspace (I am using a Premium Per User workspace)

4. Enabled XMLA read/write


Here is my PowerShell script:

$applicationid = 'xxxxxxxxxxxxxx'
$password = ConvertTo-SecureString 'xxxxxxxxxxxxxx' -AsPlainText -Force
$credential = New-Object System.Management.Automation.PSCredential ($applicationid, $password)
$Server = "powerbi://"
$TenantId = "xxxxxxxxxxxxxx"
Invoke-ProcessTable -Server $Server -TableName "Dimension Supplier" -DatabaseName "WideWorldImporters" -RefreshType "Full" -ServicePrincipal -Credential $credential -TenantId $TenantId


Here is the error that I get:

"Invoke-ProcessTable : The "WideWorldImporters" database does not exist on the server."


When I use a normal user account by signing in, the refresh works. However, it does not seem to work when I pass in the service principal. 


Any ideas of what could be wrong? 



Status: New
Community Support



You may try to add parameter -ApplicationId.

Regular Visitor

@v-chuncz-msft - I added the -ApplicationId parameter but I get the same error. See screenshot below:




Regular Visitor

@v-chuncz-msft - Can you check if a Service Principal can work with a Premium Per User workspace? I am using a Premium Per User workspace and I think that is why I am getting the permissions error message. 

Regular Visitor

I was able to confirm that service principals are not supported in Premium Per User workspaces which is why I was getting the permissions error.