Model Context Protocol (MCP) finally gives AI models a way to access the business data needed to make them really useful at work. CData MCP Servers have the depth and performance to make sure AI has access to all of the answers.
Try them now for free →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 for tasks like connecting to Power BI XMLA data, automating operations, downloading data, and more.
The CData ADO.NET Provider for Power BI XMLA is a standard ADO.NET Provider that make it easy to accomplish data cleansing, normalization, backup, and other integration tasks by enabling real-time access to Power BI XMLA.
ADO.NET Provider
The ADO.NET Provider provides a SQL interface for Power BI XMLA; this tutorial shows how to use the Provider to retrieve Power BI XMLA data.
Once you have acquired the necessary connection properties, accessing Power BI XMLA data in PowerShell can be enabled in three steps.
By default, use Azure AD to connect to Microsoft Power BI XMLA. Azure AD is Microsoft’s multi-tenant, cloud-based directory and identity management service. It is user-based authentication that requires that you set AuthScheme to AzureAD.
For more information on other authentication schemes, refer to the Help documentation.
-
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")
-
Connect to Power BI XMLA:
$conn= New-Object System.Data.CData.PowerBIXMLA.PowerBIXMLAConnection("AuthScheme=AzureADInitiateOAuth=GETANDREFRESH") $conn.Open()
-
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 $_.country $_.education }