Ready to get started?

Download a free trial of the Power BI XMLA Data Provider to get started:

 Download Now

Learn more:

Power BI XMLA Icon Power BI XMLA ADO.NET Provider

Rapidly create and deploy powerful .NET applications that integrate with Power BI XMLA.

Automate Power BI XMLA Integration Tasks from PowerShell

Are you in search of a quick and easy way to access Power BI XMLA data from PowerShell? This article demonstrates how to utilize the Power BI XMLA Cmdlets and the CData ADO.NET Provider for Power BI XMLA for tasks like connecting to Power BI XMLA data, automating operations, downloading data, and more.

The CData Cmdlets for Power BI XMLA are standard PowerShell cmdlets that make it easy to accomplish data cleansing, normalization, backup, and other integration tasks by enabling real-time access to Power BI XMLA.

PowerShell Cmdlets or ADO.NET Driver?

The Cmdlets are not only a PowerShell interface to Power BI XMLA, but also an SQL interface; this tutorial shows how to use both to retrieve Power BI XMLA data. We also show examples of the ADO.NET equivalent, which is possible with the CData ADO.NET Provider for Power BI XMLA. To access Power BI XMLA data from other .NET applications, like LINQPad, use the CData ADO.NET Provider for Power BI XMLA.

Once you have acquired the necessary connection properties, accessing Power BI XMLA data in PowerShell can be enabled in three steps.

To connect, set the Url property to a valid PowerBIXMLA workspace. For instance, powerbi://


  1. Install the module:

    Install-Module PowerBIXMLACmdlets
  2. Connect:

    $powerbixmla = Connect-PowerBIXMLA -URL "$URL"
  3. Search for and retrieve data:

    $country = "Australia" $customer = Select-PowerBIXMLA -Connection $powerbixmla -Table "Customer" -Where "Country = `'$Country`'" $customer

    You can also use the Invoke-PowerBIXMLA cmdlet to execute SQL commands:

    $customer = Invoke-PowerBIXMLA -Connection $powerbixmla -Query 'SELECT * FROM Customer WHERE Country = @Country' -Params @{'@Country'='Australia'}


  1. Load the provider's assembly:

    [Reflection.Assembly]::LoadFile("C:\Program Files\CData\CData ADO.NET Provider for Power BI XMLA\lib\System.Data.CData.PowerBIXMLA.dll")
  2. Connect to Power BI XMLA:

    $conn= New-Object System.Data.CData.PowerBIXMLA.PowerBIXMLAConnection("URL=powerbi://;InitiateOAuth=GETANDREFRESH") $conn.Open()
  3. Instantiate the PowerBIXMLADataAdapter, execute an SQL query, and output the results:

    $sql="SELECT Country, Education from Customer" $da= New-Object System.Data.CData.PowerBIXMLA.PowerBIXMLADataAdapter($sql, $conn) $dt= New-Object System.Data.DataTable $da.Fill($dt) $dt.Rows | foreach { Write-Host $ $ }