Note: Because this is an ongoing series, viewers will not receive a certificate of completion.
Skill Level Intermediate
- [Instructor] In this week's video, I want to show how we can go out and create a Linux Machine and then connect to it. In the Azure portal, go out to create a resource. And we're going to just create the Ubuntu server. Click on the Create icon, and it takes us to the new provisioning set of dialogues that step us through all the things we need to put into this to make it work. So what I'm going to do, is I'm going to create a new Linux VM. Put this into my Azure quick tip proof of concept. We're going to give this a name azqtvm-linux and we'll call this our number one.
We'll put this into an environment that is going to be living in the Central US. So pick the data center you want to run this to. Inside of the creating a Virtual Machine, I've got opportunities to create Availability zones and Availability sets. This is just going to be a test or an example of how you can go out and connect to this. So we're just going to leave that alone and then we're going to come down and pick the size of the machine. Now there's a number of different sizes that are out there, but we'll go ahead and just use the default a D2s, which has got two CPUs and eight giga memory.
And then we have to get our Administrative account. The Username msdnadmin is where I'm going to have the name of the account that I want to use. And then I have an SSH public key, now, in order to create that you have to go into a command prompt, and you can do this by using the ssh-keygen to generate key set. So what I'm going to do, is create this in my default directory, and then if you want, you could put a passphrase on it. I'm going to put a passphrase on here so that I make sure that if whoever's using this would get the same password.
And what this does, it generates the SSH key for me in my folder for .ssh/id_rsa. You'll see in here I've got my id for rsa and my public key. So, if I do a notepad id_rsa.pub, I can go out and I can copy this whole thing, copy that and then I paste that into the portal, which is going to be the full place where it's going to go.
Now, I've got my Login with Azure Active Directory, that's a Preview thing, I'm not going to play with that. I do want to allow me to connect up to this. So, I'm going to connect this on port 22, which is using SSH since this is a Linux machine. Now the other settings we have for our Disks, we can set up a data disk if we want. We've got the ability to go to premium or a standard hard drives, we've got networking, I've created a virtual network called azqt19 which is the vnet that I already have in my subscription and it's also has a Subnet for the front-end, So, I can get to it.
Now, I could also create something along the Network security group by creating special rules for it. But I'm going to have the SSH port open for the inbound. I click on Next. And we get into the diagnostics. You can add an extension. Extensions are code that gets added to a VM. So like for instance, you might have the Symantic cloud agent for this, you might have the Custom Script for Linux, you may have Stackify, or Datadog, just a bunch of different things that you could install on the machine when it gets provisioned.
And then you can go ahead and you can add the Tags. I always have a CostCenter because I need to know where I'm doing things. So we'll put a CostCenter in here and say next, and then we can go out to review and create, now it's going to run a validation make sure that everything looks right and then we can go ahead and click on Create to provision that machine. This then goes out and initializes the deployment and sends it to the Azure Fabric to provision all of the things that needs for this machine.
Now, it'll take a few minutes for the provisioning to complete, and it's going to create a public IP address, it'll create a network security group, it'll spin up the desk, it'll add the VM, and then when all of those things are done and the machine is started, then it will take us to the portal dashboard page for it. I can then go out and do things like connect to it. So we'll give that a second and then I can click on Go to resource. This then is showing me my Linux Machine where it is now open running.
I can click on Connect, and what this has, is the public IP address, but I run with my SSH command. So if I copy this and go out to my command window, I can paste that in. It'll then go out and do the connection. Since I put a pass key on to my RSA key, I just need to type that in, type yes.
Let's make sure it works. Then with that, now we're logged into the environment. And then I can go ahead and do whatever I need to. And I can see that I'm logged into my Ubuntu Machine. I've got my network directory and everything else. When I'm done, I can just exit. And that closes up my SSH. And that is how we can go out and connect up to this. Now, one of the things that I enabled is Auto-shutdown and this is an important part of any kind of demos.
You do want to enable your auto-shut down to shut down at a particular time, so, like I want this to shut down at 5 pm my time. We could send a notification if I want to to a Webhook or to an Email address, but I'm just go ahead and save this. And now this machine will automatically deallocate and shutdown at the end of the day. But that's a quick overview of creating and working with a Linux VM inside of Azure.