Alan_Rodrigues

AZ-204 - Develop Azure Compute Solutions - Azure Virtual Machines - YouTube

hi and welcome back now in this chapter we are going to go ahead and see how to create a virtual machine in azure now in order to go ahead and create a virtual machine you can either go ahead and click on creating a new resource with the plus button over here or you could go on to the virtual machine section over here and from there you can actually go ahead and create an azure virtual machine so there are different ways that you can actually go about with the creation of an azure virtual machine so if i go ahead onto the virtual (00:51) machines section over here so i already have a set of virtual machines in place currently they are in the stopped or deallocated state so normally i use these virtual machines when it comes to working actually with active directory so when i don’t have a use case for using these machines in order to go ahead and save on cos i go ahead and stop these virtual machines so let’s go ahead and create a new virtual machine so over here let me go ahead and create a new machine so over here we are now presented with a (01:34) wizard that will help us with the process of creating a virtual machine in the wizard you basically have different categories that you have to go ahead and complete in order to go ahead and create this machine so in the first screen in the basic screen you have to go ahead and choose firstly your subscription so i already have a subscription in place so remember when it comes to the billing aspect for the resources in us yaw the billing aspect is actually done against the subscription every resource in azure has to be linked (02:15) onto a subscription and every resource also needs to be linked onto a resource group so the resource group is used for logical grouping of resources so over here let me go ahead and choose one of my existing resource groups if you don’t have an existing resource group in place you can actually go ahead and click on the create new button over here and you can go ahead and create a new resource group so let me go ahead and choose one of my existing resource groups so that’s test grp now over here you have to go ahead and (02:54) give a name for the machine itself so i’ll leave it as it is now over here you have to go ahead and decide what is the region or location for the virtual machine so remember azir has a lot of regions across the world that you can actually go ahead and use for hosting of your resources now over here i’m going to go ahead and choose the north europe location now because i get least latency when it comes to connectivity to the machine in the north europe region that’s why i’m going ahead and choosing this particular (03:31) region now please know that if you are trying to follow along with the creation of a virtual machine there might be restrictions in place so if you are using an azure free account you might not be able to choose a region of your choice when it comes to the creation of the virtual machine so again based on the account you are using please note that there might be some restrictions now when it comes to the availability options so over here at the moment i’m going to go ahead and choose no infrastructure redundancy required (04:08) now next when it comes to the image so what is the underlying os the operating system that you want to base your virtual machine on so over here i’m going to go ahead and choose windows server 2019 data center now please note that you can actually go ahead and also browse for other public and private images that are available now over here when it comes to the size of the machine so currently it is assigning me a size that is known as standard underscore d2 underscore v2 so based on this size configuration it’s (04:47) going to go ahead and allocate two virtual cpus and it’s going to go ahead and allocate seven gigs of memory so this is the ram and over here you can see an estimated cost per month now if you want to go ahead and change the size of the machine you can go ahead and click on select size and over here you can see all of the sizes that are available in azure when it comes to the size of a virtual machine so over here you can see what is the number of virtual cpus for the particular size over here what is the amount of ram that you’ll (05:27) get and there are other aspects as well when it comes to the size of the machine itself and if you scroll on to the right so over here you will see the estimated cost per month now i’m going to go ahead and leave the size hazardous because i don’t want to actually go ahead and change the size now next we need to go ahead and give what is the username and password this is known as the administrator login so this is something that you provide so if you want to go ahead and log into the virtual machine you have to go ahead and (06:05) give your own username and password now please note that there are some restrictions for the password itself so firstly let me go ahead and give a username a simple username now if i go ahead and give just a simple password so over here you can see that you have some restrictions in place when it comes to the definition of the password so you have to ensure that it has at least one lowercase character one uppercase character you know one number or one special character so any one of the three needs to be part of the (06:42) password that you’re specifying over here so let me go ahead and give a password which actually meets these recommendations and i’ll go ahead and enter the same password over here now if you scroll down so there is something known as inbound port rules so let me go ahead and just leave it as it is what this port tool will do is that it will actually go ahead and allow us to connect or rdp into the instance since this is a windows based instance remember we have to go ahead and use the remote desktop protocol to go ahead and (07:18) log into the azure virtual machine now i’ll go on to next for the disks now this is the underlying disk or the volumes that is going to be attached onto the machine itself now by default it is going to go ahead and assign a disk off the disk type so over here you can see its standard ssd so this is going to be the os volume right so the volume that is hosting your operating system you can actually go ahead and assign additional data this as well for now let me leave everything as it is i’ll go on to the networking section (08:01) now by default this wizard will also go ahead and create a new azure virtual network so if you don’t have a virtual network in place it’ll actually go ahead and create a new virtual network now again any machine whether it be in azure whether it be in your company’s on-premise data center it needs to be part of a network so in azure the concept of the network is known as a virtual network now it’s also going to go ahead and create a new subnet within the virtual network for hosting the machine and it (08:38) will also go ahead and allocate a public ip address this public ipaddress allows connectivity to this machine from the internet itself again let me go ahead and leave everything hazardous i just want to go ahead and create the azure virtual machine in this particular lab i’ll go on to next for management so i’m leaving everything as it is on this particular screen so i’ll go on to next for management so over here also i’m going to go ahead and leave everything as it is now please note that there might be some changes in the (09:14) screens that you see over here so azio keeps on adding new and new features on a continuous basis for their particular services and really it’s so difficult to keep up with them so there might be smaller changes in the screens that you see over here so i do my best to try and update these chapters as best as possible based on the latest changes so for now i’m going to go ahead and leave everything hazardous i’ll go on to advanced again in this particular screen i’ll leave everything as it is i’ll go on tags leave everything as it (09:47) is i’ll go on to review and create so over here you can go ahead and review all of the settings you are specifying for the creation of the virtual machine over here the important aspect to note is that what you are going to be charged per are you can go ahead and actually review all of the settings on this particular screen and if everything is okay we can go ahead and hit on create so now over here we are going ahead with the process of the creation of the virtual machine now this might take around four to five (10:24) minutes so let’s go on to the next chapter once the completion of the virtual machine is complete hi and welcome back so in the prior chapter we had looked at the wizard to go ahead and create an azure virtual machine that is based on windows server 2019 now over here we are in the page wherein the deployment is complete if you also go on to your notifications so over here also you can see that you’ve got a notification that the deployment has succeeded so if you want to go ahead and look at the state of any action that you (11:10) actually perform on a resource in azure you can actually go ahead and look at the notifications now let me go ahead and click on the go to resource button to directly go on to the virtual machine so over here we can see all of the aspects of the virtual machine itself so we can see that it is in the north europe region we can see that the virtual machine is in the running state over here we can see the underlying os we can see the size of the machine we can see what is the subscription it is built to we can see the virtual (11:52) network we can see the public ip address and we can also see other aspects or in all things that you can actually quickly do with the virtual machine so over here we can go ahead and connect onto the machine we can go ahead and restart the machine stop the machine etc and then if you look down so you have other properties also available for the machine itself if you look at services in seo if you look at resources in seo there are a lot of features available now in another tab so if i go on to all resources so over here i have a lot of (12:30) resources in place now i had actually gone ahead and created this virtual machine as part of this test grp resource group so in another tab if i go on to resource groups we can go and filter the resources based on different you know attributes so over i can go ahead and specify the resource group so if i go ahead and choose my test grp resource group so currently over here you can see that we have some resources in place and all of these resources have been created by the wizard so that wizard which actually went ahead and created (13:08) the azure virtual machine also create a number of other resources as well so firstly it did go ahead and create the azure virtual machine then it went and create a separate resource known as the public ip address so that is the public ip address that has been assigned over here so this is defined as a separate resource in asia so remember that if you want to go ahead and connect onto the virtual machine or if you want any sort of connectivity from the internet onto this virtual machine it needs to have a public ip (13:46) address that is one way there are other ways to go ahead and access the virtual machine from the internet but this is the primary way to go ahead and access via a public ip address going back onto all resources so there’s something known as a network security group this is like a firewall which is in place for restricting the incoming and the outgoing traffic from the azure virtual machine then you have something known as a virtual network interface so this similar to having a network card on a machine itself remember all the data (14:20) from the machine actually passes via this network interface you don’t have the os level disk so remember this is the disk which will be assigned onto the machine and then finally you have the virtual network which is hosting the virtual machine itself now going back onto the machine so we can go ahead and now connect onto the machine itself so if i go ahead and hit on the connect button if i go ahead and click on rdp so that’s remote desktop protocol so over here actually we have three options in place so you have rdp which (14:53) is normal for windows machine ssh which is normally used for linux based machines then you have bastion so this is a fully managed service which allows you to connect onto virtual machines for now i’m going to go ahead and choose rdp so over here you will see that you’ll be connecting via the public ip address on the port number of 3389 now we can go ahead and download the remote desktop file so over here you can see you have the file in place let me go ahead and click on the file let me go ahead and hit on the connect (15:26) button over here let me go ahead and enter the username and password so remember this is the same username and password that you specified as the administrator account when you went ahead and created the virtual machine so let me go ahead and hit on ok so let me go ahead and hit on yes and now you will be connected onto the virtual machine so you’ve seen how easy it was to actually go ahead and spin up a virtual machine in a cr so you would have to go ahead and purchase any hardware you didn’t need to buy anything (16:05) so it’s so easy to go ahead and just spin up a machine on the azir platform right so this marks the end of this chapter hi and welcome back now in the prior set of chapters we have actually gone it and create an azure virtual machine based on windows server and we went ahead and also connected onto the machine itself now once you’re connected onto the machine you can go ahead and install a software you can go ahead and install an application you can go ahead and host any sort of workload on this virtual (16:44) machine if you want you can go ahead and install microsoft sql server you can go ahead and install mysql so the possibilities are endless just like going in and installing any application or software on your own machine you can go ahead and do the same on this machine as well and since this is based on windows server 2019 so you have more flexibility when it comes to installing server based applications as an example i’m going to go ahead and install internet information services on this machine so internet information services is a (17:21) web server that you can actually go ahead and enable on a windows server machine so internet information services has been around for quite a long time and it’s very easy to go ahead and enable it as a role on a windows server so to go ahead and install internet information services we actually have to go on to the server manager dashboard over here so normally when you log into the machine itself you’ll actually be presented with the server manager dashboard if this is not the case you can actually go on to windows and (17:55) over here you can actually go ahead and choose server manager now in the dashboard let me go ahead and click on add rules and features so over here we can go ahead and install different roles on this machine so let me go ahead and hit on next i’ll choose role based or feature based installation hit on next so over here i’ll leave the machine and ip address as it is and hit on next now over here i’m going to go ahead and choose the role of web server let me go ahead and click on add features so web (18:28) server is i’ll go on to next leave everything as it is go on to next go on to next and finally in the end let me go ahead and hit uninstall so over here just doing a very simple web server installation this will just take around two to three minutes now once the installation is complete so if i go ahead and just hit on close so now if we actually go ahead and open internet explorer on this machine itself so over here if i just go ahead and type in http local host so over here you can see you’re getting the home page for internet information (19:15) services so this is now a web server running on this machine it actually goes at and listens on port 80 for any incoming connections now if i go back on to the virtual machine if i go on to overview so i mentioned that you can actually go ahead and use the public ipad address to go ahead and connect or access any sort of services on the machine itself so if i go ahead and just copy the public ip address over here and let me go on to a new tab so i’ll paste it over here now id what should happen is that you (19:52) should actually go ahead and see the home page for internet information services but the thing is that there is a firewall in place when it comes to the azure virtual machine so this is at the azure level so over here you can see that the site can’t be reached so in order to go ahead and actually reach the site so on the machine itself you have to go on to the networking section over here so over here you have something known as network security group rules so this is like a firewall in place to go ahead and (20:31) restrict the incoming and the outgoing traffic from the azure virtual machine now please note that we do have separate chapters on network security groups for now just to ensure that we can access the home page for the web server itself what i’m going to do is that i’m going to go ahead and click on add inbound port rule so over here in the destination port range i’m going to go ahead and choose port 80 over here in the protocol let me go ahead and choose tcp i’ll ensure that the action is allowed (21:09) you can go ahead and leave the priority as it is i’ll just go ahead and change the name and let me go ahead and click on add so over here we are trying to add a firewall rule and we are saying that please go ahead and allow connectivity onto port et for this particular machine now when you go ahead and add this rule the change is going to happen immediately so if you go on to the tab wherein we had our public ip address and if i go and press enter so now over here you can see the home page for internet information services (21:52) right so in this chapter just want to go ahead and show you how you can basically host a workload on it as your virtual machine now in this chapter i want to go ahead and show you how you can publish an asp.net code application from visual studio we’ll go ahead and look at a very simple application so i want to go ahead and publish that project onto an azure virtual machine so over here i have an azure vm in place it’s running windows server 2019 and i’ve already gone ahead and installed internet information services on this (22:40) machine if i go on to the networking section so i have a rule that allows traffic on port 80 now in order to go ahead and publish the project onto this azure virtual machine there are some steps that we need to perform firstly let me go ahead and start visual studio 2019 so over here let me go ahead and create a new project so i’m going to go ahead and search for asp. (23:20) net core and let me go ahead and choose asp.net core web app c-sharp go on to next over here let me go ahead and give a name for the project let me go on to next so over here we can leave the target framework as it is so it’s dotnet code 3.1 i’ll go ahead and hit on create so once we have this project in place so if you want you can go ahead and run this project locally just to see how it looks like so it’s running this on localhost right so this is how it looks like now we could go ahead and publish this project onto our azure virtual machine (24:20) so over here for our project if we right click i can actually go ahead and hit on publish so now over here we get a wizard that helps us through the publishing process now i’m going to go ahead and choose azure and go on to next now over here we have a list of options in place so i’m going to go ahead and choose as your virtual machine i’ll go on to next now over here automatically i’m actually being redirected onto my subscription my resource group and over here i can see all of my virtual machines that i have (25:02) in seo now initially if you are publishing you know your project for the first time you might need to log into your azure account so over here is where you can actually go ahead and add an account so over here you can go ahead and add your account details over here you can then go ahead and log in with your user id and password onto your azure account once you log in then you can actually go ahead and see all of the machines that you have as part of your subscription so you can actually go ahead and choose the machine (25:38) and you want to go ahead and publish it on this machine but over here you can see that you have an error so i said there are some steps that we need to perform in order to go ahead and ensure that we can publish our project on this virtual machine so let’s go ahead and perform all of these steps so step number one let me go on to the overview over here let me go ahead and click on the public ip address now in the configuration i’m going to mark this as a static ip address and over here we have to go ahead and (26:20) give a dns name label so when we publish our project from visual studio we don’t mention the ip address of this machine we have to go ahead and mention a dns name so a domain name system name this helps to get a user friendly name onto this virtual machine so over here we have to give a name that has not already been taken if i go ahead and just specify demo vm so it’s saying this dns name label is not available so we have to go ahead and give a unique name label now let me go ahead and hit on save right so this is step number one (27:06) once this is done let me now go ahead on to the vm and let me now log into this machine so i’ll download the rdb file so i’ll just go ahead and connect onto this machine so over here just giving a diagram on the list of steps that we need to go ahead and perform so remember from our visual studio project on our local workstation we want to go ahead and publish our web application onto an azure virtual machine that is running internet information services this is a web server that is used for hosting your web (28:01) applications sometimes students ask me why do we need internet information services so this goes to the basics of hosting web applications you need to have a web server that is responsible for hosting your web-based applications so what have we done so far we have gone ahead and assigned a static ip address and we’ve gone ahead and assigned a dns name onto the vm now we also need to go ahead and add something known as a rule on to our network security group and this is for port 8172 for this as your virtual machine (28:42) before that what we’ll do is that let’s go ahead with step four and five we need to now go ahead and add something known has a management service on the vm this management service is part of internet information services what this will do is that this will allow us to go ahead and publish the project that we have on a local machine so let’s go ahead and do that first now on the machine i’m going to go ahead and click on add roles and features i’ll go on to next i’ll go on to next now over here (29:23) under the web server role i’m going to go ahead and choose management tools and over here i’m going to go ahead and choose the management service let me go ahead and click on add features go on to next go on next and let’s go ahead and hit uninstall now i’ll mark an end on to this video let’s split this video into two parts so we are ending this part with the installation of this management service we’ll come back once we have the management service in place this might just take a couple of minutes (29:59) now i’ve come back so the installation is complete now we have to go ahead and configure that management service which is part of internet information services so over here in tools let me go it on to internet information services manager let me go ahead and just expand this so i’ll go on to the machine now over here you will get something known as management service so this is when you click on your machine name over here now go ahead and double click on the management service so over here we have to go ahead and now configure internet (30:38) information services to get or take remote connections and by remote connections i mean connections from my own workstation so when i want to go out and publish a project from visual studio from my workstation i’m actually enabling a remote connection from my workstation onto this machine so over here now internet information services will allow remote connections from my machine or any machine and we can now go ahead and publish our project over here you can see that the connection goes over the port number (31:16) of 817 and that’s why we need to have that additional configuration in place we have to go ahead and also ensure that there is a network security group rule in place that allows traffic on eight one seven two so firstly let me go ahead and hit on apply so that we can apply this setting and then we need to go ahead and ensure that we start this management service this needs to be running on this machine now that we have this done i’ll go on to azure for my demo vm machine i’ll go on to networking let me go ahead and hide this (32:00) now i’ll add an inbound port rule so over here for the moment let me go ahead and leave the source has any and the destination also has any now over here in that port range i’ll go ahead and enter 8172 i’ll choose the tcp protocol the action will be allow i’ll leave the priority has it is and just give a name and let me go ahead and now click on add so this will allow traffic on port 8172 of the vm so now that we have this in place let’s go back on to our diagram so we have gone ahead and now done all of the steps (32:42) now next we need to go ahead and install the.net core so we are publishing a dotnet core based application we have to ensure that the dotnet core 3.1 is also installed on this azure vm it will not come by default on this vm you will get asp.net that’s the previous version so version 4.7 or 4.8 it depends but this is not what we need we are working with a net core based application so we need to ensure that this framework is available on that vm so over here the first thing i’m going to do is in server manager i’ll go on to (33:27) local server in i enhance security configuration let me go ahead and just turn this off you can go ahead and turn this on later on once we complete all our installations i’ll go ahead and open internet explorer and then over here let me go ahead and search for dotnet core 3.1 so i’ll go directly onto the download link now over here on the right hand side i’m looking at the asp. (34:09) net core runtime i’m looking at windows over here we can go ahead and choose the hosting bundle so if you have internet information services already in place on this vm you can go ahead and opt to install this hosting bundle this hosting bundle can work along with internet information services so i’ll go ahead and click on run i’ll agree to the license terms and conditions and hit on install so please note that we are installing dot net co 3. (34:52) 1 if you have a dot net core application that is based on let’s say version 2 ensure that you have that in place but remember dot net core 3.1 has long term support now once this is done there is one more thing that we need to go ahead and install and that’s something known as the web deploy tool this actually allows the publishing of the project onto internet information services from visual studio so over here i am going to go ahead and search for web deploy 3. (35:29) 6 so i’ll go ahead and hit on download so i’ll go ahead and hit on download over here i’ll choose the 64-bit version hit on next over here let me go ahead and allow once i’ll go ahead and click on run to go ahead and run the web deploy to once the setup screen is in place i’ll go on to next so again a very simple installation i’ll go ahead and choose complete for all of the features and then go ahead and hit uninstall now at this point in time i just want to tell students that the uh the list of steps which i’m (36:28) performing is very important so the web deploy tool should be installed right at the end if you go ahead and install the tool you know somewhere in the middle of the process you might not be able to do a proper publish of your project so ensure these list of steps are in the correct order now i’ll go ahead and hit on finish now once this is done so over here for our vm let me go ahead and quickly take the public ip address on to a new tab so we have internet information services this is the home page now over here back in visual studio you (37:09) can go ahead and close the screen again go on to your project hit on publish choose azio go on to next choose azure virtual machine go on to next choose the virtual machine so now everything seems to be in place if not you’ll actually get an error message and you can go ahead and hit on finish now over here it’s only gone ahead and created something known as a publish profile you still need to go ahead and publish your project now before that i’m going to go on to more actions and click on edit to go (37:50) ahead and edit this publish profile now over here let me go on to the connection tab over here let me go ahead and enter the password for the azure virtual machine so this is the username and password which used to log into the vm itself let me go ahead and just save the password and validate the connection over here i’m going to go ahead and save the certificate so this is the one that’s presented by the server i’ll go ahead and hit on accept once the connection is validated i’ll go on to next and now let me go ahead and (38:27) hit on save and then now let me go ahead and hit on publish so now it will go ahead and publish our project so again there are a number of steps that are involved if you want to go ahead and publish this project onto visual studio now please note that there are different ways of publishing projects onto a vm over here i’m just showing you one scenario now over here if i go ahead and refresh the page which has the public ipaddress for rbm now you can see your asp. (39:05) net core based application so now you can actually go ahead and make changes onto your application so over here if i go or let’s say the pages if i go on to the index page let me go ahead and close this so over here let me go ahead and just make a change let me go ahead and click on save again i can go on to a publish profile and hit on publish if you can’t see it over here again go onto your project and hit on publish but since you already have a published profile in place you can go ahead and hit on publish over here (39:40) it’ll now go ahead and again publish your project once this is done let’s go ahead and refresh the page and now you can see the change over here right so this marks the end of this set of chapters wherein we have looked at how to publish a project from visual studio onto an azure vm now i want to show you how you can actually go ahead and copy or publish a dot net core based web application on a linux vm so before that let’s go ahead and actually build a linux vm so over here i can actually go on to the virtual (40:32) machines and over here let me go ahead and click on add for the virtual machine itself now over here i’m going to go ahead and choose one of my existing resource groups i’ll just give a name for the vm i’ll choose my region i’ll choose no infrastructure redundancy required now over here i can see ubuntu server if you don’t see ubuntu server in the recently used you should see it in the marketplace images to get started so even over here you have ubuntu server 18. (41:15) 04 over here i’ll go ahead and choose a size that is available over here in the authentication type just to make it simple i’ll go ahead and choose password over here let me go ahead and give the details of the authentication so remember we’re going to go ahead and use the same authentication details to log on to this vm now over here in the allow selected ports i am going to go ahead and leave it has port 22 so when you log into the linux vm wire ssh it will be done on port 22. (41:53) i’ll go on the next for the disk i’ll leave everything as it is i’ll go on to networking i’ll leave everything as it is now i already have a virtual network in place in this particular region so it will go ahead and choose the same virtual network it will only go ahead and create a new public ip address and this is fine because we need a public ips to go ahead and log into the machine i’ll leave the other aspects as they are i’ll go on to management leave everything as it is go on to advance go on tags go on to (42:26) review and create and let me go ahead and hit on create now this will take around three to four minutes now i’m on a windows workstation if i want to go ahead and log on to this server on this linux vm i have to use a tool known as putty so you can actually go ahead and download from this particular link i’ve already gone ahead and installed this tool so when you go ahead and install this tool and you launch this tool over here you have the configuration here you can actually go ahead and mention what is the ip address the (43:12) public ipaddress of the vm now over here in the other tab i can see that my resource has already been deployed so i’ll go ahead on to it over here i’ll take the public ip address i’ll place it over here in the host name i’ll just go ahead and hit on enter to go ahead and connect on to the machine over here i’ll go ahead and choose yes for the server host key then i’ll go ahead and mention what is the username and password so this is the same username and password we mentioned during the (43:48) creation of the vm and now we are logged on to the linux virtual machine right so let’s mark an end onto this chapter wherein we have gone ahead and built our linux vm now in the last chapter we had gone ahead and built a linux vm now again over here in visual studio 2019 let’s go ahead and create a new project so i’ll go ahead and choose create new project over here again i’ll go ahead and choose asp. (44:31) net core and search for the asp.net core web app i’ll go on to next over here let me go ahead and give a name for the app i’ll go on to next again i’ll go ahead and choose dot net co 3.1 just for simplicity let me go ahead and not configure this for https and let me go ahead and hit on create right so again we have our project in place now over here in visual studio when you go ahead and run your project so over here you can see the option of is express so when you go ahead and actually run this you are running this on a minimal (45:16) version of internet information services that actually comes bundle with visual studio so over here now this web application is running in that is express edition apart from that you also have the ability to choose the linux app your project itself so when you go ahead and choose this let me go ahead and just run this and see what happens so over here a command prompt window will actually open let me go ahead and show that so now it’s actually running the dotnet core application your web application and it has also gone ahead and opened the (46:02) browser and now your project is running on port 5000 over here so this version of the web server that is now running is known as the kestrel web server so this is actually a cross platform web server for asp.net core so it comes bundle as part of asp.net core so this web server is enabled in the asp. (46:32) net core project templates so on your local machine in visual studio you could go ahead and run your application either on the kestrel web server on is express now we have seen earlier on how we could directly publish our project onto a windows server machine that was running internet information services so this is a proper web server that has a lot of features these web servers are just used for you know running developing debugging your applications but if you want a full-blown web server then you should choose windows server along with (47:09) internet information services now we are looking at hosting our application on a linux virtual machine so initially what we’ll look at we look at how we can actually run our asp.net core on that same kestrel web server on the linux vm itself now over here the steps that we need to perform are we can’t publish it directly from visual studio instead we have to go ahead and publish our project onto our folder on our local machine we are then going to go ahead and use a tool note so this is a free tool that is available for windows (47:55) we can go ahead and use this tool to copy the contents of this folder onto our linux vm we have to also ensure that we install the asp.net code sdk on this vm for the running of our application so over here showing you the download page for the win sap two so you can actually go ahead and download the tool so i said it’s free of cost now i’ll go ahead on to visual studio let me go ahead and stop our project if the command prompt is still open you can go ahead and close that as well now for your application right click (48:39) hit on publish now over here go ahead and choose folder go on to next so now this will go ahead and publish your project onto the bin folder release netco app 3.1 and publish so if i go on to my temp folder where i have my project so if i go on to linux app so here we have our solution file then we have all of our project files if you go on to bin so now over here in bin it is actually going to go ahead and create a release folder a netco app 3. (49:16) 1 folder within that publish and within that will be all our project binaries so let me go ahead and hit on finish now over here if i again just go on to more actions and i click on edit so over here you can see that our target framework is dot net co app 3.1 over here in the deployment mode we are saying it’s framework dependent so it’s dependent on this framework being present on the linux vm and over here in the target runtime we’re saying it’s portable so it should run on basically all types of underlying you know the architecture for the vm (49:57) itself so again not making any changes over here let me go ahead and hit on publish now once this is done so now in your bin directory you can see a release directory over here i’ll go on to now the publish folder and now this publish folder is what we need to go ahead and copy on to our linux vm so for that now i’m going to go ahead and launch the vin sap tool so when you go ahead and install the vin sap tool which is a very simple installation over here the first thing that you need to do is to go ahead and log into your (50:40) linux vm so for the linux vm let’s go ahead and take the public ip address right this is our linux vm argon and place it over here has the host name again the username and password to go ahead and log into the machine let me go ahead and hit on login over here i’ll go ahead and click on yes so now over here on the left hand side you can see the contents of ctem so over here you can actually go ahead and browse for your local directories and on the right hand side you are now in the directory of the linux vm (51:25) so what i’ll do now i’ll go onto linux app i’ll go on to the bin folder i’ll go on to release and let me go ahead and just drag the publish folder onto the server so i’m just copying all of the contents onto the linux vm now we have to also go ahead and ensure that we install the dotnet sdk so these are the commands that are also available in the microsoft documentation so over here we have to ensure that we provide first the right source of the microsoft packages then we update the packet index and then we install the (52:07) required libraries and then we install dotnet sdk so over here let me go ahead and take the first command so in your putty session over here for the vm you can just go ahead and right click and it will go ahead and execute the command then i’ll go ahead and take the second command let me right click again hit on enter and then finally i’ll go ahead and take this entire set right click and now it will go ahead and install the required packages now once this is done over here you can go ahead and clear the screen (52:58) now i can see i also have my publish folder in place so on the linux vm it’s slash home slash demo user so over here also i’m actually in the demo user folder i can now do a cd and go on to that publish folder if i do a directory listing over here i have to go ahead and run my linux app.dll so over here to go ahead and actually run this we just have to go ahead and and go ahead and do a linux app. (53:33) dll and now it has gone ahead and it’s running now our project on this local vm now in order to go ahead and actually browse for the home page it’s not so simple has it seemed because currently this kestrel web server is only running on the local vm and there is no way now for us to go ahead and browse via the public ipads of this vm if you want to go ahead and actually confirm that this is running you can go ahead and right click on your putty shell over here and click on duplicate session and over here again go ahead and login (54:16) on to the machine you can go ahead and use the curl command to go ahead and get a response from localhost 5000 that’s what the web server is running on basically your web application and over here you can see your web application as it is over here you can see the html of that application right so what we’re going to do now in the next chapter we’ll now see how we can actually browse for this home page by the public ipaddress of the vm for that we have to go ahead and install a web server on this vm itself (55:04) so in the last chapter we had seen now how we could run our dot net application on align xvm on the kestrel web server so we had gone ahead and performed these steps now let’s say has a user i want to go ahead and see my application running if i go ahead and browse for the public ip address of the vm so for this we are going to go ahead and use a proper web server we are going to go ahead and install nginx so this is a web server that is available that you can actually go ahead and install on the linux vm (55:42) now once you install nginx we have to go ahead and do a configuration and the configuration on nginx is we have to go ahead and tell nginx whenever a request comes for the home page basically on port 80 then direct that request on to the application running on port 5000 so over here we are trying to do a redirection or basically a translation of the request from nginx onto our application running on port 5000 so let’s go ahead and see how we can accomplish this so the first thing we have to do is to go ahead and first install the nginx web (56:24) server so firstly in our last chapter remember that we were going ahead and we ran our application on the kestrel web server now in order to go ahead and perform a proper shutdown you have to do a control c so let me go ahead and do that so i’ll go ahead and hit on control c right so now the application is shutting down now i’ll go ahead and right click and install the nginx software so we have the pseudo app get installed in genex over here i’ll say yes to go ahead and install this let me go ahead and also ensure (57:14) that in the list of steps i change it accordingly now once the installation is complete let me go ahead and just clear the screen now over here for linux vm i’ll go ahead and take the public ipaddress i’ll go on to a new tab now over here i am not reading the home page for nginx because i need to go on to the networking section i need to go ahead and add an inbound port rule for port 80 so i’ll leave the source as any the destination has any in the service i’ll go ahead and choose http over here let me go ahead and just give (58:01) a name for the rule and click on add so we’re adding a rule to allow traffic on port 80 so let’s just wait for a minute now after waiting for a minute let me go ahead and refresh this page and now i can see the home page for nginx so now over here i want to ensure that when i go on to the ip address of this vm on port 80 i’m now redirected on to our. (58:36) net application which is running on the linux vm so i said we need to go ahead and do a configuration change now before i do the configuration change i’m firstly going to go ahead and stop engine x because i’m making a configuration change so over here for the poly session let me go ahead and again right click and let me go ahead and stop the nginx web server once this is done in the bin sap tool we can actually go ahead and ensure that we make a change onto the required configuration file of nginx so for that i’ll go ahead on to the top (59:21) level folder so i’m in the top level folder over here i’ll go on to a folder known as etc then in this folder i’ll go on to another folder that is nginx so this folder will be in place once we install nginx i’ll go on to another folder known as sites available and we have to go ahead and make a change onto this file now before we actually make a change on to this file we have to ensure that we give permissions to us to go ahead and make these modification steps so firstly in the booty session i’m (1:00:00) going to go on to etc nginx sites available so over here in putty i’ll go ahead and do a cd slash etc so now i’m in the etc folder i’ll go on to nginx and then i’ll go on to the sites available folder now over here i’ll just go ahead and give permissions onto that file the default file then i’ll go over here let me go ahead and actually hit on refresh now you can see the rights have actually changed now obviously your linux administrator can go ahead and give you more refined rights since this is (1:00:47) basically just for development purposes i’m going in and giving full rights i’ll go ahead and double click on the file to go ahead and open the configuration file now over here the thing that we need to change is this particular section so over here i’ll go ahead and replace this section so again this is also available in the microsoft documentation but i’ll go ahead and ensure that i also add this has a resource now over here you can see that we are ensuring to pass the request onto localhost 5000 that is where our dotnet (1:01:22) application will be running now i’ll go ahead and click on save now in winscp if you get an error that’s fine you can go ahead and hit on skip to confirm you can go ahead and close this again double click on the file and you should be able to confirm that the contents are indeed in place now next let’s go ahead and start our nginx service right let us also now start our dotnet application so you can actually go on to slash home slash demo user over here yeah you should be having your publish folder so go on to the publish (1:02:14) folder so we have our linux app so let me do a.net linux app dot dll right so we have this also running so now if i go ahead and refresh this page you can now see your dotnet application right so in this chapter just want to show you how you can use nginx to go ahead and route request onto your dotnet application hi and welcome back now in this chapter i want to go ahead and introduce azure resource manager templates or arm templates now we are all familiar with the ability to go ahead and add a new resource in (1:03:06) azure so for example over here if you want to go ahead and create a vm you can go ahead and choose the vm image over here and then you’ll go through these different screens to go ahead and define your virtual machine resource now with the use of arm templates you can actually go ahead and actually submit a json based template which already has all of this information in place you can then go ahead and submit this template on to azure and the azure resource manager will actually go ahead and build those resources based on that template (1:03:54) the advantages of having templates are so you can actually go ahead and you know programmatically go ahead and define your infrastructure it also helps in reuse so if you want to go ahead and deploy the same resource over and over again let’s say in different environments you can go ahead and use that same template so your azure resource man template is nothing but a json based document or script over here you can go ahead and define resources that you want to deploy onto azure so this could be your as your vms your (1:04:36) as your storage accounts or even and as your sql database over here i’m giving the link wherein you have the syntax for the template so it follows a particular template format which is given over here the main part is your resources section so over here this actually defines the resources that need to be deployed you also have other aspects such as what is the version of the template that is being used so over here this is actually mentioned has the content version you also the version of the template language that is being used (1:05:23) you also have parameters that actually help you to go ahead and actually provide values during the deployment to make it much more flexible your variables that can be reused within the template and you also have functions and resources and you also have outputs as well so outputs are values that can be retrieved after the resource deployment now let’s go ahead and use an inbuilt template that is available for deploying an azure vm so over here in azure i’ll go on to all resources i’ll go ahead and click on add (1:06:03) and over here i am going to go ahead and search for template deployment i’ll go ahead and hit on create now over here we could go ahead and build our template our own template in the editor we could go ahead and use what are the common templates we also have some quick start templates this is all available in github over here let me go ahead and choose the template for creating a windows virtual machine now over here we are directed onto the basics wherein we need to go ahead and enter some information this is basically (1:06:42) the parameters we can then go on to review and create and this will go and actually create a vm if i actually go on to the edit template section so over here we have a lot of code in place that actually is used for the deployment of the template now before going on to the aspects of the template i just want to go ahead and again explain the basic aspects when you go ahead and deploy a virtual machine now please note that from a development perspective you don’t need to know details about these deployment aspects (1:07:25) over here you just need to have an overall aspect when it comes to the deployment when it comes to arm templates as an as your administrator it’s at that point in time that you need to really understand in depth when it comes to arm templates so before we go on to the template of the vm just a reminder on what goes into the deployment of the virtual machine in azure so when you go ahead and deploy a vm in azure remember it needs to be part of a azure virtual network so this is like a house for hosting the virtual machine (1:08:06) the virtual network has an address space and within the virtual network you’ll go ahead and define a subnet the subnet will actually be hosting the virtual machine then you’ll have a network interface this actually can have the private ipa address and this network interface is a separate resource that is bound onto the vm then you have another resource that is the public ipaddress this allows communication from the internet onto the vm itself and then you have a network security group that is actually also attached (1:08:43) onto the network interface that helps to filter out the inbound and the outbound traffic so all of these are separate resources that also need to get deployed as part of that arm template so if you actually look at the arm template so the code can get quite long if you have a lot of resources that need to be deployed over here you have the parameter section so this is what you want to ask the user during the deployment of the template this allows to you know have dynamic values when you want to go ahead and deploy the template so for example if (1:09:31) you want to go ahead and ask the user what should be the account credentials for the vm what should be the name of the vm you can go ahead and specify it has a parameter if i go ahead and scroll down so over here we also have as part of the parameters we’re asking the user for what should be the os version so over here this is like a syntax for the arm template we are saying that in the parameters this would be the default value and you could also go ahead and choose other values as well again going it and scrolling down so we (1:10:08) have some variables which are also defined over here again going in and scrolling down now we come on to the resources section so in the resource section it is going ahead and deploying a storage account so this is used for storing the diagnostic logs of the vm so by default this is enabled if you go ahead and scroll down even further so you have now the definition of the public ip address if you go ahead and scroll down the definition of the network security group again if you go further down you have the definition of the virtual network (1:10:45) and if you go ahead and scroll down you have subnets etc now if i go on to the definition of the virtual machine itself over here you can see something known has a depends clause so if i go a bit on top so the virtual machine when it’s deployed it also depends on other resources so it depends on the network interface so over here you require the network interface to be created first before deploying the virtual machine because that network interface will be attached onto the vm so this is a dependency so you can go ahead and have (1:11:24) the depends on clause within the templates to go ahead and manage dependency across resources so over here let me go ahead and just click on save even though i’ve not made any changes now in the deployment screen over here you can go ahead and choose now a resource group over here you can go ahead and give what should be the admin username and password over here is going to go ahead and give a name for the public ip address over here you can see the os version so by default it’s 2019 data center but you (1:11:59) can also go ahead and choose other versions as well remember this is mentioned in the parameters of the arm template over here the vm size the location and the vm name now i can go on to review and create and over here you can go ahead and hit on create so remember one of the biggest differences over here you just have one screen the basic screen where you’re entering the basic information the other information about the virtual network the dis everything is mentioned within the template itself and then you can go ahead and hit on (1:12:37) create so now this template will automatically go ahead and deploy all the resources that are mentioned in that arm template let’s come back once this is complete now once the deployment is complete so it’s giving me a button to go it on to the resource group because we have a lot of you know resources that were deployed as part of the template but if you go on to the virtual machine section so over here you’ll see your simple vm in place so now all of these resources have been automatically deployed onto cr (1:13:18) and please note that you can actually go ahead and take these json templates you can go ahead and make changes you can actually go ahead and submit these templates via the azure command line interface or even buy a powershell you could also go ahead and version control those json based templates probably in github so remember this is your programmatic way to go ahead and manage your resources in asia now a tool that we’ll be using during this course is the azure cli the azure command line interface so using this tool you can go ahead and (1:13:58) issue commands against resources that are part of your azure subscription it’s very easy to go ahead and start using this tool so you can go on to the install section you can go ahead and choose on what os you want to install the tool on and it’s a very straightforward and simple installation it’s a free tool you can go ahead and download and install the tool now you could also go ahead and run the azure cli directly from within azure itself so one way is to go ahead and download the tool on your local system and run it (1:14:37) but you could also go ahead and run the azios cli from the azure portal itself so over here we have something known as azure cloud shell so you can go ahead and run both your powershell commands and as your cli commands from here itself and i’ll be running all of my cli commands from azure cloud shell so i’ll go ahead and launch azure cloud shell now the first thing that you need to do in order to go ahead and use azure cloud shell is to go ahead and mount storage so you need to go ahead and create an azure storage account because an azure (1:15:15) file share is required for the persistence of files so over here i’ll go on to show advanced settings i’ll go ahead and choose my subscription i’ll go ahead and choose an existing subscription over here i need to go ahead and give a unique storage account name and i can go ahead and give any name for the file share and i can go ahead and hit on create storage so it will just take a minute or two it will go ahead and create the storage account and it will go ahead and log into azure cloud shell now in this chapter we are going to go (1:15:58) ahead and use the following commands just sample commands in azure cloud shell these are azure cli commands the first command is to go ahead and create a new resource group so for that we have to go ahead and use a command of a z group create over here we give the name of the resource group and what is the location of the resource group next we are going to go ahead and create a virtual machine using the azvm create command over here i mentioned what is the resource group to create the virtual machine in what should be the name of the virtual (1:16:39) machine and what is the image to use for that virtual machine so over here it will go ahead and use windows server 2019 over here i am giving the admin username to use for the vm now this is a quick create command that is available for creating vms on azure over here you will note that i am not first of all mentioning what is the location to create the vm in so it will go ahead and default on to the location of the resource group itself so it will be created in the east u. (1:17:20) s location and also other aspects such as your virtual network the network interface the network security group is not mentioned over here so it will go ahead and create its own default version of the network security group the azure virtual network etc please note that you can go ahead and use the azure cli commands to create all of these aspects but just to go ahead and give you the important note on using azure cloud shell on using azure cli commands i’m going to go ahead and use this quick create command so now over (1:17:56) here i can see that i have logged into azure cloud shell now over here i can go ahead and start executing my commands so i’ll right click and hit on paste and i’ll go ahead and hit on enter to go ahead and execute this command so i can see it has already gone ahead and create a resource group i’ll go ahead and clear the screen now in another tab if i go on to all resources now in another tab if i go on to virtual machine so i can see i have nothing in place now let me go ahead and execute this command to go ahead and create a new vm (1:18:38) so over here again i’ll right click hit on paste to go ahead and create this vm now it’s asking me to go ahead and mention the password so remember when you go ahead and create a virtual machine you have to go ahead and mention what is the admin username and password you then go ahead and use these credentials to go ahead and log into the vm itself so over here i have already gone ahead and mentioned what should be the admin username but i’ve not mentioned the password so over here we can go ahead and mention what should be (1:19:10) the password to go ahead and log into this virtual machine so now it will go ahead with the process of creating the virtual machine so this will take around four to five minutes let’s come back once this is complete now once the command has executed successfully if i go on to the other tab where i have my machines i’ll go ahead and hit on refresh and i can see my vm in place so you can easily go ahead and interact with your azure resources using azure cli commands now in the earlier chapter we had gone (1:20:03) ahead and seen how to create an azure vm using azure cloud shell now in this chapter i want to go ahead and show you how you can use powershell to go out and perform the same task now powershell is basically a cross-platform task automation solution so over here you have a command line shell as well in which you can actually go ahead and execute commands but with powershell you can not only work with azir you can work with other resources as well so if you just want to work with your windows machine you can go ahead and have powershell commands or (1:20:40) scripts that can go ahead and interact with your machine and works on windows linux and mac os so there is a module that is also available for azure so powershell can also go ahead and run commands against the azure platform as well so we’ll go ahead and look at those commands so over here again i am going to go ahead and create a new resource group and i’m going to go ahead and create a new vm that will be part of that resource group to create the new resource group i’ll issue the command of new az resource (1:21:15) group i’ll go ahead and give a name for the resource group and the location and then i’ll go ahead and create the new azure virtual machine with the help of the new azbm command over here i’ll give the name of the resource group what is the name of the vm what is the location what should be the name of the virtual network what should be the name of the subnet what should be the name of the security group again this is just a short form for actually creating the azure vm again over here this is a very short (1:21:48) form statement to go ahead and create the azure virtual machine you have powershell commands in place to go ahead and create the azure virtual network to go ahead and create the subnet to go ahead and create the public ipaddress etc and i’m going to go ahead and execute these commands again in azure cloud shell itself so i’ll go on to azure cloud shell i’ll go ahead and clear the screen and let me go ahead and issue the first command to go ahead and create a new resource group so it’s already done (1:22:26) then i’ll go ahead and issue the command to go ahead and create now a new azure vm i’ll go ahead and hit on enter now over here i have not gone ahead and specified what should be the username and password for the administrator account credentials for the vm in the statement so it’s going ahead and prompting me for these values so let me go ahead and enter the values now over here it’s saying no size has been provided for the azure virtual machine so it will be created with the default size so this might take again around three to (1:23:05) five minutes let’s come back once this is in place if i go on to the vm section so currently i only have one vm in place that’s demo vm now once the commands have execute if i go on to virtual machines and if i go ahead and hit on refresh so i can see my new vm in place so you can also go ahead and use powershell to execute commands against your azure resources