Pipe Jira Service Desk Data to CSV in PowerShell

Ready to get started?

Download for a free trial:

Download Now

Learn more:

Jira Service Desk Data Cmdlets

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



Use standard PowerShell cmdlets to access Jira Service Desk tables.

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

Creating a Connection to Your Jira Service Desk Data

You can establish a connection to any Jira Service Desk Cloud account or Server instance.

Connecting with a Cloud Account

To connect to a Cloud account, you'll first need to retrieve an APIToken. To generate one, log in to your Atlassian account and navigate to API tokens > Create API token. The generated token will be displayed.

Supply the following to connect to data:

  • User: Set this to the username of the authenticating user.
  • APIToken: Set this to the API token found previously.

Connecting with a Service Account

To authenticate with a service account, you will need to supply the following connection properties:

  • User: Set this to the username of the authenticating user.
  • Password: Set this to the password of the authenticating user.
  • URL: Set this to the URL associated with your JIRA Service Desk endpoint. For example, https://yoursitename.atlassian.net.

Note: Password has been deprecated for connecting to a Cloud Account and is now used only to connect to a Server Instance.

Accessing Custom Fields

By default, the connector only surfaces system fields. To access the custom fields for Issues, set IncludeCustomFields.

$conn = Connect-JiraServiceDesk  -ApiKey "$ApiKey" -User "$User"

Selecting Data

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

Select-JiraServiceDesk -Connection $conn -Table Requests | Select -Property * -ExcludeProperty Connection,Table,Columns | Export-Csv -Path c:\myRequestsData.csv -NoTypeInformation

You will notice that we piped the results from Select-JiraServiceDesk 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.

Deleting Data

The following line deletes any records that match the criteria:

Select-JiraServiceDesk -Connection $conn -Table Requests -Where "CurrentStatus = Open" | Remove-JiraServiceDesk

Inserting and Updating Data

The cmdlets make data transformation easy as well as data cleansing. The following example loads data from a CSV file into Jira Service Desk, checking first whether a record already exists and needs to be updated instead of inserted.

Import-Csv -Path C:\MyRequestsUpdates.csv | %{
  $record = Select-JiraServiceDesk -Connection $JiraServiceDesk -Table Requests -Where ("Id = `'"+$_.Id+"`'")
  if($record){
    Update-JiraServiceDesk -Connection $jiraservicedesk -Table Requests -Columns ("RequestId","ReporterName") -Values ($_.RequestId, $_.ReporterName) -Where ("Id = `'"+$_.Id+"`'")
  }else{
    Add-JiraServiceDesk -Connection $jiraservicedesk -Table Requests -Columns ("RequestId","ReporterName") -Values ($_.RequestId, $_.ReporterName)
  }
}

As always, our goal is to simplify the way you connect to data. With cmdlets users can install a data module, set the connection properties, and start building. Download Cmdlets and start working with your data in PowerShell today!