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

Did you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now

Reply
kprabha2020
Microsoft Employee
Microsoft Employee

Access PowerBI dataset model through powershell OleDbConnection

Hi,

 

I'm trying to access the PowerBI dataset model through powershell using OleDbConnection with the following code.

It is throwing an access issue error message but the same code was worked fine a few months back.

 

$connection = New-Object -TypeName System.Data.OleDb.OleDbConnection
$connectionString = 'Provider=MSOLAP.8;Initial Catalog=sobe_xxx-xxxxx;Data Source=pbiazure://api.powerbi.com;MDX Compatibility=1;Safety Options=2;MDX Missing Member Mode=Error;Identity Provider=https://login.microsoftonline.com/common, https://analysis.windows.net/powerbi/api, 929d0ec0-7a41-4b1e-xxxx-xxxx;Update Isolation Level=2'
$connection.ConnectionString = $connectionString
$command = $connection.CreateCommand()
$command.CommandText = "SELECT [ID] AS [ModelID], [Name] AS [ModelName], [ModifiedTime] AS [ModelModifiedTime], [StructureModifiedTime] AS [ModelStructureModifiedTime], [Version] AS [ModelVersion] FROM $SYSTEM.TMSCHEMA_MODEL"
$Sourceadapter = New-Object -TypeName System.Data.OleDb.OleDbDataAdapter $command
$dmvResultSet = New-Object -TypeName System.Data.DataTable
$Sourceadapter.Fill($dmvResultSet)

 

Error :


Exception calling "Fill" with "1" argument(s): "User '<pii>72f988bf-86f1-41af-91ab-2d7cd011db47-xxxxxx</pii>' needs to be an administrator to read the
metadata of the database 'f0fb13c2-ebd3-4135-ae5d-xxxxx'."

 

Please help me if you encountered the similar issues and have any solutions for it, it will be a great help.

 

Note: Given the owner access to the workspace for the above user

1 REPLY 1
v-lionel-msft
Community Support
Community Support

Hi @kprabha2020 ,

 

Are your the Power BI administrator?

What is Power BI administration 

 

Best regards,
Lionel Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.