DevOps for your Organization – Part 8: Deploy to Test

In the previous post, we demonstrated how to package up your project and publish artifacts as part of a build process. In this post, we will be:

  • Creating a test environment in Azure
  • Connecting that test environment to Azure DevOps
  • Deploying our site to the test environment

This will be the continuous deployment portion of the DevOps process.

Create a Test Environment in Azure

To host our demo web application, we will be using an Azure Web App. This is a PaaS offering from Microsoft where they host your code for you and abstract away the underlying virtual machine. Azure offers a free tier for experimentation. That is what we will be using. Below, I will cover the basics of creating a Web App. However, Microsoft has an excellent quick start guide to help you better understand the process of creating a web app.

  1. Open up the portal to the home page. Click Create a resource.
  2. Select Web App
  3. Fill out the form. For reference, below is the information that I used. As of this writing, to use the free tier, you need to elect to have .Net Core 3.0 with the Windows operating system.
  4. Finally, click create. This will kick off the creation of the web app resource.

With that, we have our web app to which we will deploy our package!

Deploy Our Site

Now, we will set up our release pipeline which will deploy our packaged ASP.NET Core application from our build artifacts to the newly created web app in Azure. Because we are using Azure DevOps, there’s tight integration between the two products. Because of this, creating the pipeline is incredibly easy.

  1. Open up the Releases section and click New pipeline
  2. This should create a new pipeline. As soon as it opens, it will give you the option to choose a template. Select Azure App Service deployment.
  3. Next, we need to add the artifacts that we generated in the build pipeline. Click the Add an artifact box.
  4. This will open a tray on the right. We will choose the build that we made in this post. Below are the settings that I used. The name of your build might be different. By setting the Default version to Latest, we will always be scheduling the latest code to be deployed. Note that this can be changed at deployment time if you need to deploy an older version of your code (e.g. rolling back a change that broke something).
  5. Finally, we will need to configure the connection with Azure. Click on 1 job, 1 task.
  6. Under Azure Subscription, click Manage
  7. This will open the Service Connection page. Here, click Create service connection
  8. Click on Stage 1. Under Azure subscription, choose the Azure subscription you used to create the web app. You may need to authorize access to it.
  9. Under App service name, choose the web app that you created. Below are the settings for mine
  10. Click Save in the upper right corner

With that, we’ve created our release pipeline. We can test it out by clicking Create release in the upper right corner. Since we configured it to deploy the latest code, you can simply click through to create. You should see the message bar pop up saying that the release has been created.

Clicking that should open up the release that you can visually follow. You can click in to the stage’s logs for more details.

Opening our site, we can see the new site has been deployed.

In our next post, we will be covering how to set up release gates, QA approvals, and continuous deployment triggers. Stay tuned!

Let Us Help You Out!

Code Vanguard has worked with clients of all sizes, helping them to use DevOps practices to accelerate their time to delivery. If you’d like Code Vanguard to help your organization with your DevOps process, feel free to reach out to us!

This post is part of the DevOps for your Organization series, where we walk through some basic steps you can take to move your organization towards the DevOps process. The full series can be found here. If you’d like Code Vanguard to help your organization with its DevOps process, feel free to reach out to us!

James Stephens About the author

James is the founder of Code Vanguard and one of its developers. He is an applied mathematician turned computer programming. His focuses are on security, DevOps, automation, and Microsoft Azure.

No Comments

Post a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.