Integration Guide

vsts logo Visual Studio Team Services (VSTS) Integration jira server

Connecting to Visual Studio Team Services jira server

This process requires an existing Microsoft account with VSTS git projects.

  1. On your Jira Server dashboard menu, go to Git > Manage Git Repositories.
  2. The git configuration page for connecting repositories is displayed.
  3. On the Auto-connect integration panel, click Microsoft.
  4. git for Jira Server auto-connect panel - select microsoft
  5. On the following screen, select Visual Studio Team Services (VSTS): jira server - connect wizzard - vsts login screen
    • Enter your personal access token (PAT) on the provided field.
    • take note
      In your VSTS repository account setting, the PAT should be set to All accessible accounts. As for the Selected scopes:
      • Code (read)  –  This scope allows only to view commits and smart commits, and browse repositories (if enabled) of connected VSTS repositories inside Jira.
      • Code (read and write)  –  This scope has the Code (read) functions plus the ability to create branches and pull request to specified VSTS repositories via developer panel of a Jira issue.
      helpful tip
      If you have not yet generated a personal access token (PAT):
      1. Go to your VSTS repository then navigate to your Account > Security.
      2. On the left sidebar, select Personal access tokens then click Add.
      3. Enter a descriptive name for your PAT. Since this is a connection to Jira, you can name it for example, git-integration-for-jira.
      4. Select desired expiration.
      5. For Accounts, we recommend to set it to All accessible accounts.
      6. On the Authorized Scopes, choose the scope that this token will authorize for your specific tasks (see the note above).
      7. Click Create Token to finish creating your PAT.
      When you're done, make sure to copy and save the token. This token can be used as your password.
    • Click Connect to continue.
  6. Login to your Microsoft account, if prompted.
  7. On the following dialog, Git Integration for Jira add-on will read all available repositories from VSTS. Click Import repositories.
  8. Repositories of the logged-in Microsoft user can be automatically connected to Jira Server.  Repositories that are added or removed from VSTS will be likewise connected or disconnected from Jira Server.
  9. After the import process, the Settings dialog is displayed:
  10. jira server connect vsts settings dialog
    • On the Integration Settings, setting the Require User PAT option to ON, will require users to provide a PAT specific for branch and pull requests (via the developer panel on the Jira issue page). The recommended Selected scopes setting for this is Code (read and write).  For more information on this feature, see Integration Settings: Require User PAT icons.
    • Set Smart Commits and Repository Browser to enable/disable these features.
    • Set Project Permissions according to your organization's project association rules.
  11. Click Finish.  For now, only git projects are supported from VSTS.

Linking VSTS Git Commits to Jira Server

This process requires a VSTS git repository.

  1. On your web browser, login to your VSTS account then go to your working repository.
  2. Clone this repository into your Visual Studio IDE.
  3. vsts web ui get clone url ... or update your local repository files by performing a Pull action via VS IDE > Team Explorer. vs ide team explorer sync/changes perform pull
  4. Create or modify a file from your local repository.
  5. Perform a commit of the changes via Team Explorer > Changes.
  6. vs ide team explorer changes - commit and push
    • Enter the commit message by mentioning the Jira issue key to associate this commit to. (Underlined in red).
    • Click the dropdown on the Commit All button then select Commit All and Push.
  7. The commit is now displayed in the specified Jira issue.
  8. View of a commit from VSTS repository in a Jira issue

Working with Branches and Pull Requests with VSTS Jira Server

This process requires a VSTS git repository and a PAT with at least Code (read and write) scope.

  1. On your Jira Server, open a Jira issue.  On the Jira developer panel under Git Source Code, click Create Branch.
  2. The following dialog is displayed:
  3. Jira server issue page create branch dialog
    • Select a Repository from the list.
    • Choose a Base branch.
    • Enter a Branch name or leave it as is (recommended).
    If the Require User PAT option icons  is enabled in the Integration Settings and a user PAT isn't configured yet for the selected repository via Repository Browser, the following dialog is displayed instead: jira server issue create branch dlg PAT required
    • Click the link label to setup the PAT.  This will show the Repository Browser listing connected git repositories.
    • jira server repository browser enter user PAT
    • Click the  icons  icon to setup a valid PAT for the selected repository.  Paste a valid PAT of the current user to proceed.  Invalid PATs will fail the branch creation process.
    • Click  icons  to use this PAT and save it to the current user profile. Click  icons   to cancel setting up PAT for this repository.
    • After the above steps have been taken, the users will be able to proceed with branch creation.
  4. Click Create Branch.  The newly-created branch is now listed in the developer panel under Branches.
  5. On your VS IDE, go to Team Explorer and perform a Pull action.  This will update your local repository with a new branch list.
  6. Go to Team Explorer > Branches.
  7. Under Active Repositories, expand the remote/origin folder view.
  8. Right click the new branch then select Checkout.  The new branch will be listed in the active repositories list.
  9. Make changes to a file to prepare it for commit and branch merge.
  10. On the Team Explorer, click Changes.
  11. vs ide team explorer commit to selected branch
    • Make sure that Branch: displays the name of the newly-created branch.  If not, select it again from the list.
    • Add the Jira issue key to the commit message. (Underlined in red).
    • This will associate the commit to the mentioned Jira issue key.
    • Click the dropdown on the Commit All button then select Commit All and Push.

The commit is pushed to the new branch and is now ready for merge.

Pull Request

The pull request feature works the same as merge request.

To create a pull request and merge it to the main source (master):

  1. On your Jira Server, open the Jira issue where your previously created a branch.
  2. On the developer panel under Git Source Code, click Create Pull Request.
  3. The following dialog is displayed:
  4. Jira issue page create pull request dialog
    • Select Repository from the list.
    • Choose the newly-created branch as the Source branch.
    • Set master as the Target branch.
    • Enter a descriptive title or leave it as is (recommended).

    If the Require User PAT option icons is enabled in the Integration Settings and a user PAT isn't configured yet for the selected repository via Repository Browser, the dialog below is displayed instead:

    jira server issue page create pat dialog requiring to setup pat
    If an invalid PAT was configured for the selected repository, the pull request creation process will fail.
  5. Click Create to create the pull request.

The pull request is listed on the developer panel of the Jira issue page.

The pull request is also ready for approval by the reviewers in your VSTS web portal.

vsts web portal pull request reviewer approved

Merging Branch to master

Continuing from the above steps, the current branch is ready for merge.

  1. On the Team Explorer, update your local repository by performing a Pull action.
  2. Go to Pull Requests.
  3. The pending pull request items are displayed here.  Pull requests requires the approval of the reviewers before it can be merged from the VS IDE.
    vs ide team explorer pull request list approved from vsts web ui
  4. Go to Branches.  Click Merge.
  5. The following screen is displayed:
  6. vs ide team explorer branch merge action
    • Set the source to the branch to which you pushed the commits.
    • Set the target branch to master.
  7. Click Merge to continue.

The reviewer's approval is required to completely merge the pull request.  This usually takes place in the VSTS portal where your updated code is being reviewed.

vsts web portal pull request reviewer approved

Once approved, the team leader or reviewer can then complete the merge.  The commit can be viewed in the associated Jira issue page.

jira server issue page git commits tab view commit