I have been working on an Azure Pass Project recently and try to leverage VSTS DevOps CICD features to automatic the build and deployment process. Thanks to my colleague Sean Perera, he helped me and provided a deep dive on the VSTS CICD process.
I am writing this blog to share the whole workflow:
- Create new project in VSTS, create Dev branch based on the master branch
- Establish the connection from local VS to the VSTS project
- Push web app codes to the VSTS dev branch environment
- Set up the endpoint connections between VSTS and Azure:
- Login to the Azure tenant environment, create new registration for VSTS tenant.
- Generate service principle key and keep it safe
- Come to VSTS online portal, go to settings -> services-> create a new service endpoint, the service principal client ID will be the Azure application ID, service Principle key will be Azure service principal key.
- Click “Verify connection” to make sure it passed the connection testing
- Go to Create a build definition:
- Define the build task: select the repo source, define the azure subscription, the destination to push to, all the app settings and parameter definitions
- Go to Triggers and enable the CI settings:
- Create a new release definition
- Define the release Pipeline: where is the source build and where is the environment, in my case, I am using VSTS to push codes to Azure PaSS environment.
- Enable the Continuous Deployment settings
- Define the release tasks: in my case I am using pre-build deploy azure app service and also swap from staging to prod environment
- Auto build and release process
Once I make change on my project code from my local visual studio environment, I commit the code and push up to the VSTS dev environment, VSTS will automatically start the build and release process, complete the release and push to Azure web app environment.
- Done, test my code in the dev and prod environment. It looks good. the VSTS DevOps features speed up the whole deployment process.