![]() |
VOOZH | about |
The CData Cmdlets Module for Jira Service Management is a standard PowerShell module offering straightforward integration with Jira Service Management. Below, you will find examples of using our JiraServiceDesk Cmdlets with native PowerShell cmdlets.
You can establish a connection to any Jira Service Desk Cloud account or Server instance.
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:
To authenticate with a service account, supply the following connection properties:
Note: Password has been deprecated for connecting to a Cloud Account and is now used only to connect to a Server Instance.
By default, the connector only surfaces system fields. To access the custom fields for Issues, set IncludeCustomFields.
$conn = Connect-JiraServiceDesk -ApiKey "$ApiKey" -User "$User" -InitiateOAuth "$InitiateOAuth"
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.The following line deletes any records that match the criteria:
Select-JiraServiceDesk -Connection $conn -Table Requests -Where "CurrentStatus = Open" | Remove-JiraServiceDesk
The cmdlets make data transformation easy as well as data cleansing. The following example loads data from a CSV file into Jira Service Management, 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!
Download a free trial of the Jira Service Management Cmdlets to get started:
Download NowLearn more:
👁 Jira Service Management IconAn easy-to-use set of PowerShell Cmdlets offering real-time access to Jira Service Management. The Cmdlets allow users to easily read, write, update, and delete live data - just like working with SQL server.