Welcome back! On part 1, I have shown you how to deploy your Azure resources with the power of Azure DevOps. Now it is time to deploy an application on top of that infrastructure. To make this more interesting I will setup continuous deployment so that we first deploy to a staging slot and if successful automatically deploy to production.
If you haven't seen part 1 yet, you can find it here: Azure DevOps - Infrastructure Build
For this example, I will use the simple-feed-reader App available from the Azure samples in GitHub. Simple-Feed-Reader App
Clone it and make it available in your own repo.
From the Azure DevOps project created earlier:
- Click on Builds
- Click on New pipeline
- Click on Use the visual designer
- Click on GitHub. A Service Point should already when you have set it up in Part 1
- Select the simple-feed-reader repo
- Select the master branch
- Click on Continue
- Select ASP.NET
Nothing has to be changed here.
- Click on Save & queue (3 times)
- Click on the link for the current build
After a couple minutes you will see all the steps have completed successfully and now you have an artifact which will be used by the Release pipeline to deploy the app to App Services. The artifact is just a zip file with your compiled application.
Now it is time to create the Release pipeline.
- Click on Release, New Release
- Apply the Azure App Service deployment
- Name it Staging
- Click on the jobs and tasks links on the Staging stage
- If not already selected, select Staging
- Select your subscription
- Select Web App as the App type
- Select your App Service created earlier
- Select the Deploy Azure App Service task
- Tick the box to Deploy to slot
- Select the Resource Group where the App Services is located
- Select the Slot staging
- Click on Save
- Return to the Pipeline page
Great, the Staging stage is done now. If you wanted we could deploy right now to the staging slot. But first let's create the production slot so that we can see the CD happening.
- Hover your mouse on the Staging stage and click on Add
- Select Apply for the Azure App Service deployment
- Name it Production
Now repeat all steps we did for Staging but without ticking the box to Deploy to a slot. Once you do that, return to the pipeline and it should look like the picture below.
- Click on Release and Create a Release. Then click on Create
Once that is done you should see both stages completed successfully and you should be able to browse to your website in staging and production.
Hopefully by now you know the basics of Azure DevOps and the power it provides to you. Keep tuned because soon I will post another article on how to deploy Azure Policies with Azure DevOps.
No comments:
Post a Comment