How to setup a build and release pipeline with Azure DevOps and Azure App Services

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello world and welcome to this edition of tech on fire with blazes his blaze Stuart architected when elected a we're gonna be looking at a DevOps as it relates to Azure app services today we're gonna be looking at Azure DevOps as a release to Azure app services now we're not only going to scratch the surface on Azure DevOps because it's a very rich tool and I might do a series in the future on Azure DevOps and everything it does on tech on fire but today we're just going to show you how to set up a quick build and release pipeline on Azure DevOps for app services now as your DevOps is a tool for managing projects it provides you a lot of project management features such as boards for managing sprints tasks bug releases it does everything that you need for managing code so you can have get repos you can have versioning against those get repos and it has all the security features baked into it so that you can not only manage security as it relates to code but also have things like gated check-ins security as it relates to pull requests as security as it relates to who can do builds and who can do releases and all the things that go into that so there's a lot there in hazard DevOps that you can set up and customize for your liking depending on your project management style and your organization's requirements but we're going to focus mainly on pipelines today and these pipelines are the automation tools in hazzard DevOps and these are designed for builds tests and deployments we're focusing on builds and deployments today and we're not looking at tests but the tests the pipelines you can integrate with builds and deployments and get a full-blown pipeline from checking a code into a repository all the way through deploying that into a production environment with everything in between and have it all automated using Azure DevOps in a previous video we looked at how you could use app services with integration with something like github to do deployments were specifically focusing on DevOps today so the story looks similar to that except it's gonna involve DevOps now we would imagine that we have a local repository on our local dev environment and we're working in some ID maybe it's Visual Studio code may miss officials to do maybe it's something written in Java but regardless you have that code and it's on your local box you have it working and compiling everything looks good and you want to push that to your repo and that's hosted on Azure DevOps so then you do a get push after you do your commit and then that code gets checked in to your get repo now with Azure devops what you can do is trigger a build based on what gets pushed into that repo now there's a lot of ways to do this sometimes it's done by pushing into the master branch or sometimes it can be done by way of a pull request into the master branch so you have a developer that checks it into a a development branch that he's working on or she's working on and then they submit a pull request and then somebody that can administer that pull request goes in and then takes that pull request and merges that into the master branch then which then triggers a build against that master branch so it could be done by way of checking code in or pull requests against that master branch or any other branch for that matter and then that code goes from a master branch to a build pipeline now that build pipeline will take the code from the repo and then check it out and then it's going to build that so it's going to convert the code into a binary of some kind and then that binary now is ready for deployment so the next thing that the pipeline will do is take that binary and put it to some form that can be deployed so in the case of a web app that might be just a zip file and it puts it into a pipeline output basically a drop folder on Azure DevOps so that that that particular build can be picked up by release pipelines no release pipelines can be triggered in a number of ways too they can be trigger manually on a timer or they can be triggered as the output of a build so that anytime a build actually fires it can also trigger the subsequent release pipeline that's waiting on output from a particular build pipeline so then that build pipeline triggers the release pipeline which then picks up the drop from the build pipeline and it then will do something with it now it might do just simply unzip that and then FTP it to a server but in the case of azure DevOps what is probably going to end up doing is doing a web deploy using the azure CLI or some tool like that and it's going to take that binaries and then push that up to app services and then that application will then be running on Azure app services I'm here in side of visual studio and I'm looking at a sample project that I used in a previous video that basically does arithmetic and this project is very minimal so it's trivial code but it does illustrate what I'm trying to show here now I've connected this particular project to Azure DevOps so if I look at my connections here I have my boys apps visual studio a common I have math API as a repo on my instance of Azure DevOps and I set this up when it was called visual studio calm and Visual Studio online after doing DevOps before they rebranded it as your DevOps so it's still got that visual studio comm extension at the end of it but otherwise it's add your DevOps and I've got this set up to connect to this so if I went down here to manage connections I could add in a connection and then sync my code with whatever's inside of a DevOps and we're gonna go through that process after I set up my build pipelines so with my code already here I have already done a push to Azure DevOps so everything here is up-to-date on my repo which is inside of DevOps so if I come over here to repos here's that project that I was just looking at in Azure inside of Visual Studio and now it's on Azure DevOps and this is where I'm going to base my builds off of so with these repositories in mind I'm gonna come down here to pipelines and I'm going to add a build pipeline here and that's what I want to do for the build right here so I'm going to create a build pipeline it's going to ask me where I'm gonna get this from and I'm gonna say as or get repos and there's my math API now this pre-populated pre-populated this build pipeline with a Yama file and this is how you define these build pipelines inside of your azure DevOps environment no this is a yam we'll file that basically does some basic tasks so it's saying what's the trigger here it's the master branch of my repository so that's what's going to trigger this build pipeline I'm setting a variable here called build configuration and I want to use a release configuration rather than a debug because I'm targeting my production quote unquote environment and the next thing is to find some steps and tasks that are related to this pipeline this next step is actually what does the build itself it does a dot never store which is basically downloading some new get packages and putting those into the repository on the the actual build agent that's going to be running this and then this is actually what calls the build so it does a dotnet build with the release configuration and the display name is a dinette build with the display configuration and once this completes right here it does two more tasks the first one is actually a write the the build out to an output folder using the the dotnet core publish here so I want to help take that the configuration build right here and publish this using.net so it's going to call dotnet publish and then you'll release configuration and then output that to the artifacts staging directory and then this task down here will actually take of that output from this and then put it into a container that can be used for releases so once I have this I'm going to hit save because I know this works cuz I've run it before and I'm gonna come down here to releases and this is where I'm going to build my release pipeline so i'ma hit new pipeline here and in this stage I'm going to select over here from one of the templates as your app service deployment I'm gonna hit apply and this one is going to say who's mine who's the owner of this and I must say I am that's fine and this is stage one so I'm gonna come in here and and configure stage one of this particular release pipeline and I'm going to select blaze app services connection and I'm going to say web app for Windows which is fine and then I'm going to select the app service name that I want to deploy this to so it's called blaze - app demo which I've already built on Azure and I'm not going to go through the process of showing you how to do that but basically it's an existing app service that you can use and I've already configured the Azure subscription so if you want to do that you can click manage here and then that's how you connect guys are DevOps - as are using the manage tool here so once I have those defined I can get out of this and then I can you know save this and come over here and that saves a step one and I will come back over here to pipelines and then I'm going to set up the actual artifact that will trigger this so basically I want to get the output from a build so I'm gonna select math API emmalin's select this select the math API and then I'm gonna take the latest version and the source alias which would be math API here there's no build API that's published anything yet but in any case this is will be populate and once I actually do run a build so I'm gonna go ahead and add that as the source the for this and that's the artifacts that are dropped by my to build pipeline so once I have that I'm going to configure the trigger here and I'm gonna do enabling trigger when a new release is every time a new build is available or I can do that based on a pull request trigger I must select this first one because that's the one I want to fire whenever my build pipeline is finished so basically whenever my build pipeline runs this pipeline will get triggered and then deploy it to adder so with that I can close this out and save it and now my build pipeline and my release pipeline are defined so if I wanted to go ahead and run this I could come down here and hit come into this and hit run pipeline and choose the branch I'm going to use and so on and then I'm gonna click run and this will run so we'll come back when this finishes okay now that my my pipelines that run I can go back and review these pipelines so here's the build pipeline that ran and will show me the last run on it and I can come down and drill into the tasks that were running all of this and shows me all the output that kind that from the agent that actually did the build and once the build is finished it gets handed off to the release pipeline in here I could have my release pipeline and you will show you the steps that were run here as well so I can come back here and look at the job initialized downloaded the artifact that was there build output and then deployed adapt service and then finalize the job so this is my full full fully run app service output now I can go back in and make some changes to this and then check those in so let's go ahead and do that and I'm going to change something down here maybe a trivial change but it will it will cause a difference in the code so it says only I could do something like only Chuck Norris can divide by by zero and then I'm going to save this and then I'm going to check it in so to do that I'm gonna come over here to my solution Explorer and I'm going to go ahead and commit this and then once I've committed it I'm gonna put in Chuck Norris for the comment and I'm gonna go ahead and commit this and then I'm going to go click on sync here and I'm going to do a push to my source code repository so now I've actually done a push of a change file which is this one down here to Azure DevOps now if I come back down here to azure DevOps I should be able to see my build now that is running because this was triggered by Chuck Norris because that new push is now running so I'm gonna go ahead and let this run and then we will see what happens whenever this is finished now that my build and release have run I can go back and again look at my pipelines and I can say you know what what did run here so if I come back here here's my new release that just ran and this is the latest release that got pushed back to my app service environment but I can also look at my review my builds as well so here's the the Chuck Norris build and I can go through and look at the steps it says he shows me the diff there that I changed and then if I want to go back into and actually look at the steps in the job I can look at the initialized job to check out the the command line build process the deployment process and so on and then I can go back and review the release steps as well and look at these so now that this is actually up on app app services let's go to the portal and we can log in and see this and see if we actually can see what's going on with it so that's my app service right here and if I pull this up I can go over here and pull up the API and I'm gonna run some air exceptions on this so that I can see that exception show up and a pin size which I actually have running against this so I'm gonna go math divide one by zero and this should give me an exception but in the the logs for this it should show me that Chuck Norris can only divide by zero so I'm gonna run this a few times and then have that exception show up a bunch inside of app services app insights so that I can get an idea of the change that I actually made inside of my code now I'm back in Azure app insights for my as a web app that I'm running an app services here and here you can see the spike of requests that came in and this is a Spiker request that I just initiated for this particular web app and this one should have the exception that I'm looking for so if I select these right here these are all the requests that I just did with that divided by zero error now if I come into the account here I ran it a bunch for like 37 times I guess and if I come into my an instance of this I can then go and look at the actual data as it relates to what I did so I have math / 0 that was actual thing I read now if I click on exception they should show me the error so there's the error that I put into the code only Chuck Norris can divide by zero so now you can see here that I was able to use a change in my code push that to Azure DevOps and then trigger a build and then trigger a release and then go all the way through to production and then they actually have app insight to pick up that change and show it as an exception so this is an end-to-end demo showing you everything that you can do with app services very quick demo but there's a lot more that can go on with this but at the end of the day setting up a bill pipeline for and happen from code to deployment using Azure DevOps is a very enticing because of all the features that azor devops offers and when it comes to doing DevOps if you like this content please consider visiting us online at www.cannainsider.com/itunes content becomes available and also comment down below you can also follow me on twitter at the one mule and also follow intellect alum twitter at win elect now or app win elect we were constantly posting things about hazard related technologies and things related to software development you can also reach us by email at consulting Edwin elect calm until next time thank you [Music] you
Info
Channel: WintellectNOW
Views: 14,556
Rating: 4.9733334 out of 5
Keywords: Azure, DevOps, Deployments, Build, Release, App Services
Id: cgwnRrjLK6k
Channel Id: undefined
Length: 17min 46sec (1066 seconds)
Published: Thu Dec 26 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.