Azure DevOps - How To Deploy Webapp to IIS Server | Deployment Groups | #azuredevops #devops

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
as part of our deployment process we would want to deploy code to different destinations it could be some cloud service like Azure or a virtual machine or an on-premise server when we are working with Azure devops deploying to an Azure app service is quite easy I have discussed about this in this video where we created a build and release Pipeline on Azure devops to deploy a web application to Azure app service you can find the link to that video up here and also in the description box below thanks to you all as we reach 150 subscribers Milestone I look forward to your continuous support for expanding this channel further thanks again getting back to our topic this time we will use the same build and try to deploy to a server instead of a pass service like Azure app service we need to do few additional steps to make this work I'll be using an Azure VM but the steps are same for an on-premise server as well so let's get started [Music] thank you welcome back so in this video we'll see how we can deploy the build to a on-premise server or a virtual machine so we'll be using the same build which we created in this video as shown here so if you are not aware of how to create a build you can check out this video and learn how to set up your build pipeline to build a net core web application now we'll use the same build to create a release pipeline which would be deploying to a virtual machine for that first we have to create something called as deployment groups so here in the screen you have an option in the pipeline section as called deployment groups so let's come to that section and create a new deployment group we can specify a name so let's call it we call it Dev VMS as I'm using a virtual machine and click create and it gives you a registration script using which we will register that machine with Azure devops so that's how it works that when you set up a Development Group you have to link your server to Azure devops so that the agent can deploy the code to that server earlier there was a different mechanism using Windows Remote Management which you could set up in release pipelines and you could deploy the code but that method has been deprecated and now the recommended option is to create deployment groups and use that to deploy your code so let's come to our machine so to start with I'll create a virtual machine on Azure which we can use for our deployment I've created a resource Group and I'm creating a sample web app server and I'm using Windows 19 machine and a standard size with some server admin user credentials and also I have enabled HTTP https and RDP for now so ideally we shouldn't be enabling RDP on a Azure virtual machine but since we are only testing so we'll just enable this and we also need that remote connection to set up our server so let's go and create it I'll keep rest of the a setting similar and just go ahead and create the virtual machine so let's just continue with the default selected options so please note this may not be the ideal options you should select when you are creating an Azure VM but Our intention is not to create a VM but to deploy a code to that VM so I am not changing anything for now I have the virtual machine ready I'll just open it and and download the RDP connection details just open this I will use my admin credentials to connect to the server now that we have connected to the server the first and foremost thing we have to do is enable IIs on This Server so let's click on the server manager add rules and features and select web server so we have to include management tools everything click next any framework we want otherwise we can go ahead so let's click next and install it will take few seconds to install it so let's wait complete this now the installation is complete let's close this now before we deploy our application we have to install the.net runtime as well so since we are using.net core as the framework for our application we have to install that if we were using the traditional.net framework that already comes with Windows Server so for that let's go to dotnet.microsoft.com and welcome to this all.net6 downloads and download the hosting bundle so will not download any other runtime we'll use the windows posting bundle which is a single package which has everything that you need for running a.net core application on iOS so we'll open this file and install it it's a pretty simple installation and it's done in few seconds now a server is ready for deployment we can proceed with the next step the next step is we'll come back to deployment group and copy copy this script so check this option use personal access token in the script for authentication so the personal access token is what it uses to connect to Azure devops instance from the server so let's copy the script come to our server and open Powershell just right click and it would paste the script to the partial and just enter so now it will configure This Server to be connected to Azure devops instance and include the server as as part of the deployment group it's trying to connect to the server and registering the agents what it does is it also installs similar agents which we use as part of devops pipelines it installs a similar agent on this server and through that it connects to Azure devops it's asking to enter tags if we want to tag this server with any particular tag suppose so with this is a web server so let's give it a web tag sorry my bad it it has asking whether we want to assign tags so let's give it yes and then call it web and it's added so whether we want to enable unrestricted we'll keep it as no and we'll keep the default setting for this and whether to prevent the survey starting immediately after complete configuration no we want to start it immediately so let's just press enter and it is set up so let's come back to a deployment group and click on targets and you can see that it has shown up in our deployment group if you want to add more you can click on this register option and it would give you the script again and you can copy the script and add and run it on a new server so that way you can add more servers to this deployment group now our deployment group is ready so let's go to release and create a release pipeline for deploying this code let's create a new release sorry let's create a new release Pipeline and come to this one we could also choose empty job and set up all those tasks but this kind of gives you a quick way to do it so is website deployment let me click apply change the stage name to Dev and also let's add the artifact so if you have not seen the previous video artifacts are the builds which was created by the build Pipeline and we can choose that artifact so we can select our pipeline this is the pipeline which we want to use.net web app and it is linked to that article you can click add and this pipeline is based on the side effects this is the artifact which we will be deploying on the servers again this icon is for continuous climate if we click on this and enable antennas deployment trigger as soon as the build is ready it gets deployed to the server for now let's keep it disabled and click on this option so let go let's go to this deployment group and select our Dev VMS this is the deployment Group which we created it we could have we could put a web tag if we want but since we don't have anything else we we are fine with this in the latest artifacts we can select our artifacts as of now if there is no issue and here we want to use the default website if you want to change this if suppose you have multiple sites on your server and you want to use a different name you you can see that the name is associated with parameters.website name then come and change the parameters on this Dev tile or Dev Tab and here you can see there are properties which you can Define so if you want to update the website name you can come and update here and it would be updated for these tasks as well so we are okay with the manage task let's come to deploy so on deploy task our website name is again same and we have to select the package which is to be deployed on the server so here it is trying to deploy a dot zip file so if you come to this browse button and if we check the linked artifacts you can see that we have a zip file that's what we are trying to deploy so we are fine with this setting and we don't have to change anything now the next thing we have to do is to substitute the settings in our app settings file the project which we are using is having connection strings and in the local file we are having the setting as localhost and local database which we want to update to the setting which is on the dev server so for that first we have to mention the files which are to be updated as mentioned in the help text here we have to provide the list of Json files which are to be substituted with variable files variable values so to do that let's just do double star which means folder and any folder and subfolders and settings.json now the substitute how the substitution works is that it will try to substitute the values in your Json file with the values in the variables so we have to create a variable corresponding to our setting and how do we do that is as mentioned here for a setting like data under that we have default connection and connection string it has to be mentioned as data.default connection dot connection string say in our case it's connection strings and under that we have default connection so let's come to variables and add a new variable connection strings dot default connection and let's copy this value and just update it so we have Dev database and we have that server so I don't have actually a server corresponding to this setting is just a dummy setting which I'm using to demonstrate this functionality so let's come back to this and another settings is set and variable is set and I think we are good to go for deployment so let's just save this Pipeline and create a release it will be deploying to Dev and release one has been created and let's check the logs now the deployment is complete so let's check if it actually worked we'll come back to our VM and copy this public IP address so that's the IP address through which is accessible and just run it and voila the app is deployed and we have the proper connection string also set up on this server so let's come to as and just run it manager which is the command for IIs console and we come to our default site and click click explore you can see that our code is deployed here and if we open this settings it is configured here we have the updated app settings on this server and also we have web config which is working fine sometimes if you have issues with you know proper app settings being retrieved on an is server it could be a minor configuration issue you can check out with this video up here and there is a tip to work around that problem so we have successfully deployed our web application to an IIs server from Azure devops so it wasn't that that difficult right that brings us to the end of this video I hope you have liked the video let me know your comments and feedback in the comment section below if you have any particular use case in mind which you want me to cover do let me know that as well I would be happy to help you can find something interesting to learn next here thanks for staying till the end see you in the next one adios
Info
Channel: OmegaCodex
Views: 6,258
Rating: undefined out of 5
Keywords: .net core, asp.net core, azure app service deployment, azure devops, azure devops ci cd pipeline, azure devops pipeline, azure devops pipeline tutorial, azure devops services, azure pipeline tutorial, azure pipelines, azure pipelines tutorial, azure pipelines yaml, azure release pipeline, ci/cd azure devops, devops azure tutorial, net core, omegacodex, software development, iis server, azure devops iis deployment, azure devops vm deploy, deployment group azure devops
Id: zpvSfbUvl-U
Channel Id: undefined
Length: 13min 11sec (791 seconds)
Published: Sun Jun 18 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.