.Net6 + Azure + Azure DevOps
Deploy .net 6 App to Azure from Azure DevOps using Pipelines
--
Working with both Azure and Azure DevOps is always fun, and the possibilities of automation are endless. I have written many articles on these topics and you can read them here. As you all know that the .net6 is been a talk in the market and I can’t wait to try out things there. Here in this post, we will see how to use the Azure DevOps pipeline to build, restore and deploy the .net6 application to Azure Web App Service. Let’s get started.
At this point, I will assume that you have a .net6 application, Azure Web App Service, and Azure DevOps project with permission to configure the Pipeline and to add a new service connection to the Azure Resource Group. If you are not sure about how to configure the Service Connection to the Azure Resource Group, this post will help you.
Create the YAML files needed
We will be creating 3 YAML files as listed below.
- A template file with all the tasks, so that we can reuse them for the environment-specific pipelines
- A pipeline for Test environment
- A pipeline for the production environment
Template file
Let’s configure all the tasks needed in our template file. We will have 2 stages in our template. You can read this post if you are not sure how to configure the stages in the pipeline.
- Build stage, for performing the tasks below
- Install .Net Core SDK
- .Net restore
- .Net build
- .Net publish
- Publish to Azure DevOps artefacts
2. Deploy stage, to deploy the artefacts generated to the Azure Web App Service. This will involve the tasks below.
- Download the artefact
- Deploy
Our final template file will look like this.