This post is to help developers who are new to Azure DevOps releases and deploying a VS Code extension. Azure pipelines come with lots of great options but it can be difficult to know what to do to achieve your goal. The goal in this case is to deploy my VS Code extension, Git Mob to the marketplace.

I’ll provide bite size instructions to help you build a release for your VS Code extension using Azure DevOps platform. This will take about 5-10mins.

vs-code-release Build a release pipeline to VS Code marketplace

This article assumes you have built a .vsix artifact from am Azure DevOps pipeline. If not, I have created a post on how to make a continuous delivery pipeline for your VS Code extension. I wanted to keep this post about deploying via Azure pipeline specifically, to keep the steps focused.

Deploy to VS Code marketplace

We will create a “release” to deploy the built artifact to the marketplace. The YAML example at the end of the steps illustrates the commands needed to release the artifact via Azure DevOps pipeline.

Azure release pipeline UI screenshot Azure release pipeline UI showing areas covered in these steps

  1. In the left hand navigation bar under Pipelines select Releases
  2. Open the New dropdown and select New release pipeline
  3. You will be asked to select a template, unfortunately there is not one for deploying extensions to the marketplace. Select Empty job.
  4. You will only need one stage, name it what you like.
  5. Select Add an artifact box
  6. Source type is Build and Source will be the first item in the dropdown. It will be the name of your Git repository.
  7. Default version is set to latest but you can of course change this.
  8. Click the Add button when you’re ready.
  9. In stages box click the small link 1 Jobs, 0 task.
  10. On Agent Job click the plus button and search for “bash” task. Then click add.
  11. Type select Inline
  12. Copy the commands from the YAML example below starting from sudo ... to .vsix
  13. Under the Advanced tab, working directory click the ellipsis (…) button on the right and select the folder which contains the .vsix artifact file.
  14. Using your marketplace Personal Access Token (PAT) we will set an environment variable called MARKET_KEY. Get & save PAT securely
  15. In the environment variables tab add name MARKET_KEY and value $(nameOfSecureVariable)
  16. Ensure you save these changes and you should be ready to “create a release”.

Execute your release pipeline

  • To run your new release pipeline click the create release button in the top right create release button
  • A side menu will appear, all the fields are optional so you can click create

YAML example showing how to release you VS Code extension to the marketplace.

Important points:

  • vsce publish is the app & command to deploy to VS Code marketplace
  • -p $MARKET_KEY send your PAT to authorise publishing
  • --packagePath git-mob-$PACKAGE_VERSION.vsix the extension package to publish
  - bash: |
      sudo npm install -g vsce

      PACKAGE_VERSION=$(cat version.txt)

      vsce publish -p $MARKET_KEY --packagePath git-mob-$PACKAGE_VERSION.vsix
    workingDirectory: "$(System.DefaultWorkingDirectory)/_rkotze.git-mob-vs-code"
    displayName: Deploy
      MARKET_KEY: $(vscekey)

Here is the Git Mob release pipeline for reference.

Get & save PAT securely

  1. To publish to the marketplace you will need a Personal Access Token which is explained here on publishing extensions.
  2. Once you have a key, it will need to be stored privately so it can be used in the release pipeline without it being revealed in the build log. Ensure your work is saved and now let’s store that token.
  3. Click the variables tab on the top left.
  4. Insure Pipeline variables is selected on the left and click the + Add button.
  5. Add a name e.g. “vscekey” and the value is your PAT. Ensure the padlock is locked to make it a secret.
  6. Your secret variable is now ready to be accessed by the release pipeline.
  7. Finish the remaining steps above to complete the release pipeline.

I hope this has helped you to deploy your extension. Please comment below if this was useful or you came across an issue which could help others.