Create your First Release Pipeline
This article explains how to create a basic release pipeline for deployment to a development environment.
Requirements
A project administrator must first create a Deployment group that will enable you to specify target machines for your release.
Instructions
1. First we must edit the CI build to publish the artifact to the default location. Select the build you want to release and choose to Edit.
2. Add the following text to the end of the azure-pipelines.yml file. Save your changes and trigger a new build manually.
3. You should now see your build artifact by looking at the build summary. Click on the build and then on the Summary tab. Notice your build is published to the drop folder.
4. Now we can start creating our release! From our Summary screen, we can click on Release button at top. Doing it like this links our CI build artifact to the release pipeline seamlessly.
5. Choose your first stage template. In our case, it will be the IIS website deployment template. Click Apply.
6. Give it a name, then click on the tasks hyperlink under the stage name.
7. Click on the IIS Deployment job and set the Deployment group.
8. You can also define a subset of machines in the deployment group by specifying any tags that were assigned at the time of agent creation.
8. Click on IIS Web App Manage task and set the Physical path to the target machine's deployment location.
9. We will now add a variable substitution for the connection string but you can do this on many other elements in your application's configuration file. Here is our application's connection string in our IDE:
Click on the pipeline's Variables tab and click on Add. Set the name to match your configuration item, in this case it is APP_DATABASE. Then set its value and scope it to the relevant release pipeline task.
Variable substitution takes effect only on the applicationSettings
, appSettings
, connectionStrings
, and configSections
elements of configuration files.
10. Click on the lock icon to make the variable a secret.
Secret variables are encrypted at rest with a 2048-bit RSA key. Secrets are available on the agent for tasks and scripts to use (so be careful about who has access to alter your pipeline).
11. For the purpose of this exercise, let's set the release to only trigger manually (not every time that a new build is created in our CI). Click on the lightning icon to the left of the Deploy to DEV taskĀ and set the trigger to Manual only. Save your changes.
12. Now click on Create release button at the top right of the screen to instantiate a first release. Enter a comment and click Create. Now click on View releases, to view the release you just created.
13. Let's manually trigger the deployment task by clicking on our instantiated release, then hover over the Deploy to DEV task and click on Deploy. Enter a comment, then deploy.
14. Wait a moment for the agent to complete its job and you can view the results by consulting the task's log.
Wrap-up
This concludes basic creation of a release pipeline but it only begins to scratch the surface of what is possible here.
Related articles