Automate Azure Analysis Services Integration Tasks from PowerShell

Ready to get started?

Download for a free trial:

Download Now

Learn more:

Azure Analysis Services ADO.NET Provider

Rapidly create and deploy powerful .NET applications that integrate with Azure Analysis Services.

Are you looking for a quick and easy way to access Azure Analysis Services data from PowerShell? We show how to use the Cmdlets for Azure Analysis Services and the CData ADO.NET Provider for Azure Analysis Services to connect to Azure Analysis Services data and synchronize, automate, download, and more.

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

Cmdlets or ADO.NET?

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

After obtaining the needed connection properties, accessing Azure Analysis Services data in PowerShell consists of three basic steps.

To connect to Azure Analysis Services, set the Url property to a valid server, for instance, asazure://, in addition to authenticating. Optionally, set Database to distinguish which Azure database on the server to connect to.

Azure Analysis Services uses the OAuth authentication standard. OAuth requires the authenticating user to interact with Azure Analysis Services using the browser. You can connect without setting any connection properties for your user credentials. See the Help documentation for more information.


  1. Install the module:

    Install-Module AASCmdlets
  2. Connect:

    $aas = Connect-AAS -URL "$URL"
  3. Search for and retrieve data:

    $country = "Australia" $customer = Select-AAS -Connection $aas -Table "Customer" -Where "Country = `'$Country`'" $customer

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

    $customer = Invoke-AAS -Connection $aas -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 Azure Analysis Services\lib\System.Data.CData.AAS.dll")
  2. Connect to Azure Analysis Services:

    $conn= New-Object System.Data.CData.AAS.AASConnection("URL=asazure://;InitiateOAuth=GETANDREFRESH") $conn.Open()
  3. Instantiate the AASDataAdapter, execute an SQL query, and output the results:

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