This PowerShell module is designed to facilitate extracting data from a Jira Cloud instance for storage in an MS SQL Server (or other compatible) database.
To use this module, you must have a Jira Cloud instance available to extract data from, a system to run the PowerShell module, and an MS SQL Server (or compatible) database.
- You must have a Jira Cloud instance.
- The Jira account you use to access the instance must have access to read all the projects and issues you wish to extract.
- The Jira account you use must have an API token configured, and you must have the token (see API Tokens)
- PowerShell 6.1+ must be installed.
- The module PowerJira must be installed.
- The account executing the module must have access to an MS SQL Server (or compatible) database.
- If you plan to install the required database objects using the module, the account executing the module must have permission to create database objects.
Step 1: Install the module from PowerShell Gallery
Install-Module PowerJiraSqlExecuteStep 2: Install database objects with PowerShell
Import-Module PowerJiraSqlExecute
Install-JiraDatabase -SqlInstance localhost -SqlDatabase Jira -Username "DOMAIN\YourUserName"Step 2 (alternate): Install database objects manually
- Execute the scripts located at /PowerJiraSqlRefresh/public/sql/ against the database you will use with the module.
- Add the user you will execute the module with to the role JiraRefreshRole:
ALTER ROLE [JiraRefreshRole] ADD MEMBER [DOMAIN\YourUserName]With the module and prerequisites installed and database objects in place, perform the following steps:
- Import the module and its dependencies
- Open a PowerJira Jira session
- Call
Update-JiraSqlwith your desired parameters - Close the PowerJira Jira session
For a working example implementation, see PowerJiraSqlRefreshExecute
For details on the available parameters, use Get-Help Update-JiraSql -detailed
Import-Module PowerJira
Import-Module PowerJiraSqlExecute
$JiraCredentials = @{
UserName="Your Jira Email"
Password="Your Jira API Token"
HostName="Your Jira Site URL"
}
$parameters = @{
SqlInstance = "localhost"
SqlDatabase = "Jira"
RefreshType = (Get-JiraRefreshTypes).Differential
}
Open-JiraSession @JiraCredentials
Update-JiraSql @parameters
Close-JiraSessionPowerJiraSqlRefresh provides a handful of configuration options which can be supplied by the user at invocation.
The module provides two refresh modes, Full and Differential. When a Full refresh is performed, the database will be cleared of all extracted Jira data and the module will retrieve all instance data. A Differential refresh will retrieve only the deltas since the last time the refresh process was executed. Note that some tables will be fully updated, even in a Differential refresh, as the Jira Cloud REST API does not provide change tracking on all object types.
These data elements can be refreshed differentially:
- Issues (Add/Update)
- Worklogs
These data elements are always fully refreshed, even during a Differential refresh:
- Projects
- Versions
- Components
- Project Categories
- Statuses
- Status Categories
- Resolutions
- Priorities
- Issue Link Types
- Users
Because data is retrieved from the Jira instance and stored in a SQL database, all data that is visible to the Jira user configured for the refresh process will subsequently be visible to those who have access to the SQL database. Recognizing that this may unintentionally expose sensitve information that has been secured in Jira by permissions, PowerJiraSqlRefresh provides an option to obfuscate ticket contents in specified Jira projects. One or more project keys can be provided at execution time; issues within those projects will have their Summary and Description field contents replaced with the string [Redacted]
- Justin Mead - ender2021
This project is licensed under the MIT License - see the LICENSE.md file for details