Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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: 
https://powerbi.microsoft.com/en-us/blog/announcing-support-for-service-principals-using-the-xmla-en...

 

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://api.powerbi.com/v1.0/myorg/my_workspace"
$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? 

 

TIA.

Status: New
Comments
v-chuncz-msft
Community Support

@ihafidh 

 

You may try to add parameter -ApplicationId.

ihafidh
Regular Visitor

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

 

ihafidh_0-1613406119792.png

 

ihafidh
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. 

ihafidh
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.

https://docs.microsoft.com/en-us/power-bi/admin/service-premium-per-user-faq#administrative-question...