This document will help you setup a [Jenkins Pipeline](https://jenkins.io/doc/book/pipeline/) to deploy a sample app to Azure using Pulumi.
The source code will be hosted on GitHub just for the purpose of showing the GitHub integration between Jenkins and GitHub. Your source repository could be on any other VCS supported by Jenkins.
Pulumi doesn't require any particular arrangement of stacks or workflow to work in a
continuous integration / continuous deployment system. So the steps described here can be
altered to fit into any existing type of deployment setup.
## Prerequisites
- A working installation of a recent version of Jenkins.
- Setup a new project and [stack](/docs/concepts/) using one of our [Get Started](/docs/get-started/) guides or by running [`pulumi new`](/docs/cli/commands/pulumi_new)
You can download an [example project](https://github.com/pulumi/examples/tree/master/classic-azure-ts-appservice-springboot) and upload it to your own repo to avoid having to clone the entire Pulumi Examples repo into your Jenkins workspace.
To login non-interactively in to the CLI, you will need to set the env var `PULUMI_ACCESS_TOKEN` as a build parameter when setting up the Jenkins build. To [create a new access token](/docs/pulumi-cloud/accounts#access-tokens), go the [Access Tokens](https://app.pulumi.com/account/tokens) page in the Pulumi Cloud.
The classic UI lets you create manual (UI) builds, as well as a Declarative pipeline-based build. There are several options available to cater to your specific setup, but for the purposes of this walkthrough, we will assume a single branch, declarative pipeline.
### Jenkins Blue Ocean
Blue Ocean is an overhaul of the classic Jenkins UI. It features a new and intuitive pipeline configuration UI that helps you setup a CI pipeline in a matter of just minutes. [Learn more](https://jenkins.io/projects/blueocean/) about the Jenkins Blue Ocean project.
**Note** Regardless of the type of interface you choose to work with, the `Jenkinsfile` (more on that later) can be used interchangeably with both. The underlying pipeline configuration system is the same.
### Plugins
Ensure you have the following plugins installed:
- Git
- NodeJS
You can find available plugins by navigating to the Jenkins administration page and then selecting the **Manage Plugins** option on the Manage Jenkins page.
In order to deploy to one of the cloud providers, you will need to ensure that the authentication environment variables are set, so that the Pulumi CLI can use them to deploy your infrastructure resources. The set of environment variables to configure vary for each cloud. For Azure, depending on your setup, you may have to set at most 4 environment variables. In this example, we will assume you are using a [Service Principal](/registry/packages/azure/installation-configuration#creating-a-service-principal).
In order to use the Node JS plugin, you must first ensure you add at least one installation to it. Navigate to the **Global Tool Configuration** menu option on the Manage Jenkins page.
**Note** The name you enter in the configuration section will later be referenced in the `Jenkinsfile`, so be sure to save that name somewhere so you can easily copy/paste it into your pipeline configuration.

sh "pulumi stack select ${PULUMI_STACK} --cwd infrastructure/"
sh "pulumi up --yes --cwd infrastructure/"
}
}
}
}
}
}
```
## Additional Information
### Single-quotes vs. double-quotes in Jenkinsfile
While the pipeline script editor may not complain about the use of single-quotes, we have noticed that using single-quotes can cause certain commands to silently fail. It is better to use double-quotes always to wrap arguments in your `Jenkinsfile`.
### The Manage Jenkins page
You can get to the administration in one of two ways depending on which UI (Classic vs. Blue Ocean) you are using. In the Classic UI, there is a **Manage Jenkins** link on the left nav menu, and in Blue Ocean you should see an **Administration** link on the top nav. You will only see these options if you are an admin in your Jenkins installation.
Jenkins allows you to [manage credentials in a global credentials store](https://jenkins.io/doc/pipeline/steps/credentials-binding/). By using the `withCredentials` plugin, you could store your AWS, Azure or Google Cloud credentials in the credentials store, and inject it into the pipeline easily. For example, in order to use the Azure CLI credentials, you will need the Azure CLI plugin additionally. Once added, you can add a new Service Principal credential and map its properties to the appropriate env variables needed by the Pulumi CLI.