Automate Jira Integration Tasks from PowerShell

Ready to get started?

Download for a free trial:

Download Now

Learn more:

Jira ADO.NET Provider

Rapidly create and deploy powerful .NET applications that integrate with Jira data including Projects, Groups, Workflows, and more!



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

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

Cmdlets or ADO.NET?

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

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

To connect to JIRA, provide the User and Password. Additionally, provide the Url; for example, https://yoursitename.atlassian.net.

PowerShell

  1. Install the module:

    Install-Module JIRACmdlets
  2. Connect:

    $jira = Connect-JIRA -User "$User" -Password "$Password" -Url "$Url"
  3. Search for and retrieve data:

    $reporterdisplayname = "Bob" $issues = Select-JIRA -Connection $jira -Table "Issues" -Where "ReporterDisplayName = `'$ReporterDisplayName`'" $issues

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

    $issues = Invoke-JIRA -Connection $jira -Query 'SELECT * FROM Issues WHERE ReporterDisplayName = @ReporterDisplayName' -Params @{'@ReporterDisplayName'='Bob'}

ADO.NET

  1. Load the provider's assembly:

    [Reflection.Assembly]::LoadFile("C:\Program Files\CData\CData ADO.NET Provider for Jira\lib\System.Data.CData.JIRA.dll")
  2. Connect to Jira:

    $conn= New-Object System.Data.CData.JIRA.JIRAConnection("User=admin;Password=123abc;Url=https://yoursitename.atlassian.net;") $conn.Open()
  3. Instantiate the JIRADataAdapter, execute an SQL query, and output the results:

    $sql="SELECT Summary, TimeSpent from Issues" $da= New-Object System.Data.CData.JIRA.JIRADataAdapter($sql, $conn) $dt= New-Object System.Data.DataTable $da.Fill($dt) $dt.Rows | foreach { Write-Host $_.summary $_.timespent }