Join Tiberiu Covaci for an in-depth discussion in this video Create Azure VM, part of Deploying ASP.NET Applications.
- [Instructor] And now, let's see how we can deploy our web application to an azure VM. And in order for us to do that, we'll need to create and azure VM. So, we'll start by creating a resource, and we are using Windows Server 2016 VM as a starting point. And then we need to choose some properties of this machine. So, for instance, we are going to use the MSDN subscription. We're going to use the web deploy resource group, and then we need to use a name for this one. So it will be VSazureDeploy, let's call it like this.
So this will be the name of the Virtual Machine that we are creating. The Virtual Machine will be creating West US, or any region actually that is closer to you, you don't have to use West US. We need to change the size, to make it a little bit quicker. So we don't wait for too long for the machine or for the things that need to be done in azure. We're going to choose a username and a password for this.
This will be the administrator of the machine, and this user will be the one that we are going to use when we do the deployment as well. If I want to allow certain ports, and I will allow one Port 80. We don't need to do any remote desktop to that machine itself. Then we can choose this, let's take a Standard HDD. Again, we don't want to spend too much money on the machine if we don't need that. It will give me a suggestion for which network should I use.
It will ask me if I want accelerated networking. Again I don't need that because my application is not very communication intensive. Boot diagnostics, I'm not interested in. Again, I just want to see how this one will work in our situation. And now comes the interesting part, I can select an extension to install, and in my case I will select a PowerShell Desired State Configuration. So the PowerShell Desired State Configuration will require a file, and the file should be a zip.
So what we need to do, is to go and open our existing DSC files. I created a DSC file, that is a combination of the web deploy and IIS installations. So it's exactly the same thing that we had before, we had the IIS, we had the Asp.Net4.5, we have the Management Console and the Management Service, we have the WebDeploy, we EnableRemoteManagement, then we start the remote management services. And when that is done, we are going to close this, and right click on the file, and create a compressed zip file of it.
With that in mind, then we go here and select the file that we want to upload, the file that contains all of our artifacts. So we choose that file. We need to specify the name of the file that contains the configuration and the name of the configuration. And let's make sure that we use the right name. Okay again, I go in and say edit with PowerShell. I copy the configuration name from here, and then I'm going back in azure, and paste that.
We are going to use version 2.76, of the PowerShell Desired State Configuration Module. We can do an Out of Date of Minor Version in case there is a better version available. But, I know for sure that 2.76, it's the latest one, at the time of this recording. And I'm pressing okay. Next would be Tags. Again, I recommend that you use Tags for all Virtual Machines or all resources in azure. I don't really need, for the purpose of this course, and I will go next, to create a Virtual Machine.
It will do a validation of all the things that I chose. It will tell me how much it would cost me, and if I'm okay with everything, then I just press create. Now, this will take about 10 to 12 minutes to do the creation of the Virtual Machine. And once it's done, we need to add some additional configuration. And 14 minutes and 40 seconds later, our deployment is ready. And everything went as it should. We just press go to resource, and this will take us to the Virtual Machine.
As I told you, there is one more thing we need to do, and that's actually to open the port for the management service. And we go to networking, and we add a new inbound rule, inbound port rule. And instead of 8080, we need port 8172. This is a default port that webdeploy is using, and we can name the rule, instead of port 8080, to port 8172 so at least it makes sense, or we can even say webdeploy because it doesn't make any sense to keep it as a port number.
And I'm adding that. It takes a couple of seconds. And once the rule is created, then we can start deploying our application, to this Virtual Machine. Then we need to add a DNS name for the Virtual Machine. And we go in Overview, choose configure, and then we choose a name that can be available. So let's try with the vsazuredeploy as a name, and if it's available, then we are going to get a little green tick here, in case, we just press save, and once this one is saved as well, we are ready to deploy our application.
- Choosing a deployment strategy
- Installing IIS manually and automatically with PowerShell
- Deploying to IIS with Visual Studio
- Deploying to Azure
- Deploying to Docker