![]() |
VOOZH | about |
The CData Cmdlets for Zuora are standard PowerShell cmdlets that make it easy to accomplish data cleansing, normalization, backup, and other integration tasks by enabling real-time access to Zuora.
The Cmdlets are not only a PowerShell interface to Zuora, but also an SQL interface; this tutorial shows how to use both to retrieve Zuora data. We also show examples of the ADO.NET equivalent, which is possible with the CData ADO.NET Provider for Zuora. To access Zuora data from other .NET applications, like LINQPad, use the CData ADO.NET Provider for Zuora.
Once you have acquired the necessary connection properties, accessing Zuora data in PowerShell can be enabled in three steps.
Zuora uses the OAuth standard to authenticate users. See the online Help documentation for a full OAuth authentication guide.
In order to create a valid connection with the provider you need to choose one of the Tenant values (USProduction by default) which matches your account configuration. The following is a list with the available options:
Two Zuora services are available: Data Query and AQuA API. By default ZuoraService is set to AQuADataExport.
The Data Query feature enables you to export data from your Zuora tenant by performing asynchronous, read-only SQL queries. We recommend to use this service for quick lightweight SQL queries.
LimitationsAQuA API export is designed to export all the records for all the objects ( tables ). AQuA query jobs have the following limitations:
LimitationsInstall the module:
Install-Module ZuoraCmdlets
Connect:
$zuora = Connect-Zuora -OAuthClientID "$OAuthClientID" -OAuthClientSecret "$OAuthClientSecret" -Tenant "$Tenant" -ZuoraService "$ZuoraService" -InitiateOAuth "$InitiateOAuth"
Search for and retrieve data:
$billingstate = "CA" $invoices = Select-Zuora -Connection $zuora -Table "Invoices" -Where "BillingState = `'$BillingState`'" $invoices
You can also use the Invoke-Zuora cmdlet to execute SQL commands:
$invoices = Invoke-Zuora -Connection $zuora -Query 'SELECT * FROM Invoices WHERE BillingState = @BillingState' -Params @{'@BillingState'='CA'}
Load the provider's assembly:
[Reflection.Assembly]::LoadFile("C:\Program Files\CData\CData ADO.NET Provider for Zuora\lib\System.Data.CData.Zuora.dll")
Connect to Zuora:
$conn= New-Object System.Data.CData.Zuora.ZuoraConnection("OAuthClientID=MyOAuthClientId;OAuthClientSecret=MyOAuthClientSecret;Tenant=USProduction;ZuoraService=DataQuery;InitiateOAuth=GETANDREFRESH;")
$conn.Open()
Instantiate the ZuoraDataAdapter, execute an SQL query, and output the results:
$sql="SELECT Id, BillingCity from Invoices"
$da= New-Object System.Data.CData.Zuora.ZuoraDataAdapter($sql, $conn)
$dt= New-Object System.Data.DataTable
$da.Fill($dt)
$dt.Rows | foreach {
Write-Host $_.id $_.billingcity
}
Download a free trial of the Zuora Data Provider to get started:
Download NowLearn more:
👁 Zuora IconRapidly create and deploy powerful .NET applications that integrate with Zuora.