Scaling Azure Virtual Machines
Virtual Machine Storage
Configure Monitoring & Alerts for Azure VMs
The course is part of these learning pathsSee 1 more
This course offers an in-depth look at VM scale sets, VM configuration management, VM storage options, and VM monitoring within Azure. We kick things off by looking at VM scale sets, vertical scaling, and horizontal scaling.
After that, you'll learn about the tools used for configuration management, as well as how to deploy software using VM extensions and how to deploy an Azure PowerShell DSC Configuration.
The course will then cover the wide range of VM storage options available in Microsoft Azure and show you how to use them. Finally, you'll learn about Azure Monitor, a service that allows you to monitor the performance and health of your VMs and VM scale sets.
This course is packed full of step-by-step demonstrations that you can follow along with, allowing you to see all of the above topics put into practice in real-life Azure environments.
For any feedback relating to this course, please feel free to contact us at firstname.lastname@example.org.
- Scale VMs using scale sets and understand the difference between vertical and horizontal scaling
- Learn about the tools used for managing VM configurations
- Deploy software using VM extensions and PowerShell DSC
- Understand the various VM storage options available in Azure
- Restore a VM from a snapshot
- Create a VM from a generalized image
- Learn about Azure Monitor and its uses
- Anyone interested in learning about scale sets, configuration management, storage, and monitoring for Azure VMs
To get the most from this course you should have a basic understanding of Microsoft Azure and of the Azure portal.
Hello and welcome back. In the previous demonstration, we walked through the process of creating a snapshot of an OS disk for a VM and then what we did with that snapshot is create a disk from it, and then from that disk, we deployed a new VM. What we are going to do in this demonstration is create a managed image of a generalized VM, and then we'll deploy a new VM from that generalized image.
A generalized image can be seen as essentially a gold image. What you typically do is if you have a need, let's say you're going to build an RDS farm, and you need 15 or 20, or 100 VMs that are all identical. You can create a gold image, which is a generalized image and then deploy all of your VMs from that image. And essentially a generalized image is a VM that has been sysprepped and shutdown.
Now in the last demonstration, we created the My VM virtual machine. So what we're going to do to start this demonstration off is remote into the My VM virtual machine and we're going to generalize it. So lemme go ahead and connect to My Virtual Machine here over RDP. And I'm connecting to My VM on my other screen here. And I'll drag it over here. So this virtual machine is the VM called My VM that we deployed from our snapshot earlier. Once this comes up, we'll go ahead and generalize it with the sysprep tool.
Okay, so we're logged into our virtual machine and to run the sysprep tool, I'm going to launch a command prompt as an administrator. So we'll go ahead and find command here. And we will run this as an admin. Now the sysprep tool is located in the system 32 directory. It's actually located in the sysprep folder within that system 32 directory. This sysprep.exe is what we're going to run.
So we'll go ahead and bring this up. When we run the sysprep tool for our generalization for our VM, we need to make sure that the VM doesn't come back up. This VM will now function as a gold image. So as part of this sysprep, what we need to do is tell sysprep to enter the out-of-box experience, and we also want to generalize it. Remember, that's the whole point of this. And then since we don't want this machine to ever come back on, we want to shut it down.
So we'll go ahead and begin the sysprep process here. And what this will do is clean up the VM, remove SIDs, GUIDs, and all that other fun stuff, and then it will shut down the VM. Once this VM has been sysprepped, we can begin our work in the Azure portal. We can see we've just been kicked out. And if I go back out to VMStuff here, if I select my VM, I can see it's still running, but we'll let this run for a little bit, because it's going to shut down shortly. And we can see that the status has stopped. At this point we can go ahead and create our managed image from the portal. And to do that we simply select capture here at the top.
When we create our image, it's going to give us a default name, and allow us to specify what resource group it belongs to. I'm going to change this. I'll just call it My New Image. And it's going to go in VMStuff.
Now if we look here, it's telling us that before the image is created, the VM is going to be de-allocated. If you recall, and you can rewind back the video to take a look, you can see that the status of our VM in the portal was actually stopped. It wasn't de-allocated. And that's because I shut the VM down, or at least the sysprep process shut the VM down within the OS.
When you shut down a VM from within the OS, it doesn't de-allocate it in Azure. It sits there as an allocated resource, although it's in the stop state. To create this image, the VM has to go into a de-allocated state and that's what this process will do. We can also automatically delete the VM after we create the image.
Now if we hover over the icon here, we can see that once a VM is generalized, you can't do anything with it. You can't start it or modify it or anything, so there's really no point to keep that around. So what we'll do here is we'll tell Azure to automatically delete the VM once it creates the image. And then of course, zone resiliency here allows us to make our snapshot zone resilient so it can use an availability zone. I don't care about resiliency for this demonstration. I'm not too worried about it. And then in the box here for the virtual machine, I need to tell Azure or confirm with Azure the VM that we're taking the image of. You can see we have the green checkboxes. So we'll go ahead and create the image.
Now you'll notice up here we also have a warning that tells us that we need to generalize our VM before we do this process, and we did that. It's telling us we can use the sysprep/generalized switch or we can go through the process manually like I showed you earlier.
Now what's really important here, and you need to pay attention to this, is that if you create an image from a VM that hasn't been generalized, any VMs that are created from that image won't start. So that's why you need to do that sysprep piece. Otherwise you're gonna wind up with VMs that can't run.
We can see we're down here at the step four of four, and we can see that the VM has been successfully deleted. And if we go into VMStuff, and we'll do a refresh here. We can see we have My New Image. We can also see that the VM called My VM is gone. But notice the IP is still here, the network security group is still here, the NIC is still here, as is the disk. That process only removed the virtual machine.
Now because these resources are all pretty modular, deleting the VM doesn't cause any of these resources to disappear. You have to go in and clean these up manually if you don't need them any longer. I'm not going to worry about it for this demonstration. I trust that you know how to delete a resource.
But what we'll do now is we'll deploy a new VM from our image called My New Image. And to do that is pretty straightforward. We'll go ahead and select the image. And then from here we have an option to create a VM or to delete the image. We'll go ahead and create our VM. And we'll call it MyVM2.
You'll notice we don't get to choose the region, because it's going to be created within the same region as the image that it's using. And of course, if we have multiple images we could select them here. Or we could select a marketplace image. But for this exercise, we're creating our VM from our image. And then we'll select a size. And then we'll specify our admin information. Again we'll allow 3389. Don't do this in production. And we'll next it. Leave the default options for our disk.
It's going to create our new public IP, but we'll attach it to the existing virtual network. Click through, we won't do any tagging here. And we can see the validation passed. We do get another warning telling me that we don't want to open RDP to the internet, but for this lab we're fine. And we'll go ahead and create. And at this point, it's going to deploy a new virtual machine based on the generalized image that we created from My VM.
If we bounce back to our resource group, if we needed to create another virtual machine, we could simply select My New Image and create yet another virtual machine. And we can create as many VMs as we need from that image because it's been sysprepped and with a generalized image like that, you can create as many VMs as you can, and they all get new GUIDs, new SIDs, new admin information, all that fun stuff.
So that is how you create an image, and that's how you deploy VMs from that image.
Tom is a 25+ year veteran of the IT industry, having worked in environments as large as 40k seats and as small as 50 seats. Throughout the course of a long an interesting career, he has built an in-depth skillset that spans numerous IT disciplines. Tom has designed and architected small, large, and global IT solutions.
In addition to the Cloud Platform and Infrastructure MCSE certification, Tom also carries several other Microsoft certifications. His ability to see things from a strategic perspective allows Tom to architect solutions that closely align with business needs.
In his spare time, Tom enjoys camping, fishing, and playing poker.