How to pipe Zuora Data to CSV in PowerShell



Use standard PowerShell cmdlets to access Zuora tables.

The CData Cmdlets Module for Zuora is a standard PowerShell module offering straightforward integration with Zuora. Below, you will find examples of using our Zuora Cmdlets with native PowerShell cmdlets.

Creating a Connection to Your Zuora Data

Zuora uses the OAuth standard to authenticate users. See the online Help documentation for a full OAuth authentication guide.

Configuring Tenant property

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:

  • USProduction: Requests sent to https://rest.zuora.com.
  • USAPISandbox: Requests sent to https://rest.apisandbox.zuora.com"
  • USPerformanceTest: Requests sent to https://rest.pt1.zuora.com"
  • EUProduction: Requests sent to https://rest.eu.zuora.com"
  • EUSandbox: Requests sent to https://rest.sandbox.eu.zuora.com"

Selecting a Zuora Service

Two Zuora services are available: Data Query and AQuA API. By default ZuoraService is set to AQuADataExport.

DataQuery

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.

Limitations
  • The maximum number of input records per table after filters have been applied: 1,000,000
  • The maximum number of output records: 100,000
  • The maximum number of simultaneous queries submitted for execution per tenant: 5
  • The maximum number of queued queries submitted for execution after reaching the limitation of simultaneous queries per tenant: 10
  • The maximum processing time for each query in hours: 1
  • The maximum size of memory allocated to each query in GB: 2
  • The maximum number of indices when using Index Join, in other words, the maximum number of records being returned by the left table based on the unique value used in the WHERE clause when using Index Join: 20,000

AQuADataExport

AQuA API export is designed to export all the records for all the objects ( tables ). AQuA query jobs have the following limitations:

Limitations
  • If a query in an AQuA job is executed longer than 8 hours, this job will be killed automatically.
  • The killed AQuA job can be retried three times before returned as failed.

$conn = Connect-Zuora  -OAuthClientID "$OAuthClientID" -OAuthClientSecret "$OAuthClientSecret" -Tenant "$Tenant" -ZuoraService "$ZuoraService"

Selecting Data

Follow the steps below to retrieve data from the Invoices table and pipe the result into to a CSV file:

Select-Zuora -Connection $conn -Table Invoices | Select -Property * -ExcludeProperty Connection,Table,Columns | Export-Csv -Path c:\myInvoicesData.csv -NoTypeInformation

You will notice that we piped the results from Select-Zuora into a Select-Object cmdlet and excluded some properties before piping them into an Export-Csv cmdlet. We do this because the CData Cmdlets append Connection, Table, and Columns information onto each "row" in the result set, and we do not necessarily want that information in our CSV file.

The Connection, Table, and Columns are appended to the results in order to facilitate piping results from one of the CData Cmdlets directly into another one.

Ready to get started?

Download a free trial of the Zuora Cmdlets to get started:

 Download Now

Learn more:

Zuora Icon Zuora Data Cmdlets

An easy-to-use set of PowerShell Cmdlets offering real-time access to Zuora. The Cmdlets allow users to easily read, write, update, and delete live data - just like working with SQL server.