Microsoft Azure AZ-800 — Section 11: Manage Hyper-V and guest virtual machines Part 3

Microsoft Azure AZ-800 — Section 11: Manage Hyper-V and guest virtual machines Part 3

86. Understanding Discrete Device Assignment

Now, another nice feature that we have with Hyper-V is it’s called DDA, DDA stands for discrete device assignment.

So what is discrete device assignment? This a feature that originated with Windows Server 2016, and what it basically allows us to do is it allows us to give control over a hardware device such as a PCI Express device, a graphics adapter, you know, in the image stores, type device. Whatever it may be, we can pass that over to a VM and give a virtual machine control over it so that that virtual machine can take advantage of the features of that hardware device. Unfortunately, this not something I’m going to be able to show you like demonstrate just because I don’t have the hardware to do it. But if you’ve got a server that actually has a GPU in it, you can actually go through and try this out.

Now I am going to show you the concepts and the steps involved, which is going to be the main thing you’re going to want to know here.

So there’s three required steps. First step would be to configure the VM to support discrete device assignment. Then you’ve got to dismount the device from the host and pass it on to the guest VM.

So you’re going to assign that to the guest VM and you’re going to do this as an administrator using PowerShell.

OK. The other thing to understand here is that you need to make sure that the virtual machine is turned off that you’re going to give this control over. You’re not going to be able to pass control to the VM while the virtual machine is up and running.

So you don’t need to turn the virtual machine off manually, or you can run the command that you see here the set VM -VM name, then automatic stop action. And that will if you want to trigger the virtual machine to turn off without having to manually connect into it or whatever and turn it off. That’s how you can do that.

OK, next thing.

So, if you’re dealing with a graphics device, which is this what most people use this for one thing, that they kind of warn you here, Microsoft will tell you is that, you know, some of the different graphics adapters out there are going to work better for this than others. And they tell you should research it a little bit and find out what adapters are going to work best for what you’re trying to do. You might even need to reach out to hardware vendors to confirm that they work really well with your server, with servers in general. But there’s lots of articles out there about different hardware vendors and Nvidiand all of that that that canutilize this. The next is there’s a couple of commands you’re going to want to run, and I’ve got those listed here for you. And this mostly going to involve memory so you can do what’s called right combining on the CPU between the host computer and the virtual machine.

So you would want to run those two commands against the virtual machine that you’re doing this with.

So you make sure the virtual machine is off and then you can run these commands. Next on the machine that the host machine that actually has the adapter, the graphics adapter or whatever type of device you’re passing on, you need to go into device manager, go to the properties of that driver for that and go to the Details Tab and you need to copy the path. As you can see, you can just right click and copy the path and that is called your device location path, which you’re going to need for the next command.

So the next thing you’re going to do is assign the device over to the guest VM. This the final step for getting this set up, and you’re going to use this PowerShell command right here. Add -VM assigned device, -Location Path, and then you’re going to paste that path in there that you copied and then -VM name in the name of the virtual machine. This going to be the most important command if you’re taking the exam. Hint, hint. This the command that you’re going to want to memorize right here.

OK.

So just make sure you are aware of that. And then at that point, you’ve officially assigned that device as a bonus if you ever want to remove this. You can. You can remove and return the turn things back to the way they were. There’s a remove command right there. Remove -VM assigned device and then the Mount -VM host assigned device. This basically re mounting the device back to the host machine. And that’s how you can do that. Microsoft if you go out there and do a just do a quick Google search on this feature, Microsoft has an article that goes over the step by step by step in details that will show you exactly how to do this for the real world. But that is the concept of how you can actually pass devices from a host machine or a like a graphics device or in VM device directly onto a virtual machine.

87. Configure VM Resource Groups

Now, one of the common questions that sometimes people ask about Azure is, is it possible to group your virtual machines together into into some sort of a container to separate things? Well, obviously there is an azure. You got what’s known as a resource group in Azure lets you do that. But Hyper-V on-premise. If you had if you were using the systems in a virtual machine manager, there was a way to do it there. But as far as just plain Hyper-V itself, there’s no graphical way that you can group your virtual machines together. However, there is a way you can do it PowerShell and this known as a virtual machine groups or virtual machine resource groups. And there’s two kinds of resource groups. There’s a resource group called a VM Collection Group, and this just going to let you group your virtual machines together in a group container so that if you ever wanted to perform actions against that group, like start all the virtual machines at the same time or stop all of them at the same time you could. There’s also what’s called a management collection group, and this really just a parent group.

So, if you created a bunch of virtual machine collection groups, you could group those collections together into a group. And then if you had different groups and you wanted to nest those under a parent group, that’s what is known as a management collection group.

So, I want to demonstrate how we can do this in PowerShell, and I’ve already created a little PowerShell script to take a look at here that we can kind of analyze together.

So here I am in the PowerShell ISC. And again, if you don’t know how to get into PowerShell is you just go into PowerShell and type ISC, and that’ll bring you into the integrated scripting environment. And from there, I’ve got the following command.

So the first command set here is going to create two collection groups. I’m going to create a group called VM One, a Group one and VM Group two.

So, I’m just going to highlight this and I’m going to hit play. And I’m now officially created the two Groups Collection Group one collection group to. All right. They don’t contain anything in them right now, but I’ve created them, you can see the output down here. The next thing I’m going to do is create the manager group.

So, we’ll create a manager group and I’m just going to call this management group like that.

So, I’m going to hit play on this and have now officially created a management group.

Now I want to add my two virtual machines into my coat. I’m going to create I’m going to add my virtual machine called NYC DC one into the VM Group one and then NYC Server one into Group two.

So, if we look back over Hyper-V, this going to go into the first group. This going to go into the second group. That’s the idea here.

So, we’ll go ahead and we’ll just run this first line. All right. And we’ve now added that server to VM Group one, and we’re going to go ahead and do the second one. All right.

So, it is now in Group two.

OK. And so from there, we’ll say we’ve got ad collection groups to the management group.

So now we’re going to do is going to add these two groups Group one and Group two to the management group as a parent.

So, we’re going to highlight these and we’re going to hit play. All right. And we’ve now officially added the two groups to the management group.

So let’s view the contents of these groups. We’re going to highlight this command here. Hit play and we can see VM Group one right here. We can see that currently just has this member here in y’see, server one group.

Sorry, NYC DC one is another group VM Group one and then VM Group two. We’ve got N.Y.C. Server one and then the management group, as you can see it, currently has VM Group one and two. All right.

So a couple of additional things I can do. I can get info about my group’s this little command here. Get VM, select or get VM pipe symbol, select name and groups. Hit play on that. And this going to show me all of my groups. All right. And the VMS. And then if I run, if I was to run this command start VM. This a way that I could tell every VM to start in my management group.

OK, now let’s go back up here real quick and. Let’s change the we’re going to go right here and watch what happens if I say, add Veeam Group one name VM Group one -and we’re going to add NYC Server one to that.

So, we’re going to go right here and we’re going to hit play on that. All right. And now let’s go back over here and run these commands again to see the members.

OK, so, If we scroll back up, you’re going to see we have Veeam Group one. And notice that Vingroup one now has both VMS located in NYSE -DC one, as well as NYSE Server one and VM Group two, has NYSE server on it.

So my point showing you that is that a virtual machine can be a member of multiple groups at a time you can have them, you’d have groups that contain the same VMS.

So just like VM, one now contains both of the VMS. M.2 still only contains NYSE server one.

So, if you when you do add a virtual machine to a group, it’s actually being linked to the group so the virtual machine can be linked to multiple groups if you want. All right. And that is how we can use virtual machine resource groups.